{
  "id": "enwiki-001362779318",
  "slug": "flexible-array-member",
  "title": "Flexible array member",
  "qid": "",
  "lead": "C struct data types may end with a flexible array member with no specified size: typedef struct { size_t len; // there must be at least one other data member double arr[]; // the flexible array member must be last // The compiler may reserve extra padding space here, like it can between struct members } DoubleArray; Typically, such structures serve as the header in a larger, variable memory allocation: // see section on size and padding DoubleArray* darray = malloc(sizeof(DoubleArray) + ... * sizeof(double)); darray->len = ...; for (int i = 0; i len; i++) { darray->arr[i] = ...; // transparently uses the right type (double) }",
  "body": "C struct data types may end with a flexible array member with no specified size: typedef struct { size_t len; // there must be at least one other data member double arr[]; // the flexible array member must be last // The compiler may reserve extra padding space here, like it can between struct members } DoubleArray; Typically, such structures serve as the header in a larger, variable memory allocation: // see section on size and padding DoubleArray* darray = malloc(sizeof(DoubleArray) + ... * sizeof(double)); darray->len = ...; for (int i = 0; i len; i++) { darray->arr[i] = ...; // transparently uses the right type (double) }",
  "categories": [
    "20286173",
    "23118434",
    "23267558",
    "23603337",
    "60231876"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1362779318",
  "content_hash": "",
  "created_at": null,
  "updated_at": 1783302399.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "enwiki-001362779318",
    "type": "webpage",
    "title": "Flexible array member",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/flexible-array-member",
    "issued": {
      "date-parts": [
        [
          2026,
          11,
          15
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          15
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:enwiki-001362779318",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1362779318",
    "note": "Immutable snapshot enwiki-001362779318"
  }
}