encyclopegia.org

Flexible array member

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) + ...[src] * sizeof(double)); darray->len = ...; for (int i = 0; i len; i++) { darray->arr[i] = ...; // transparently uses the right type (double) }[src]

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) + ...[src] * sizeof(double)); darray->len = ...; for (int i = 0; i len; i++) { darray->arr[i] = ...; // transparently uses the right type (double) }[src]

4 sentences · 4 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Flexible array member." encyclopegia.org, 2026, https://encyclopegia.org/wiki/flexible-array-member. Accessed 25 November 2026.

Chicago

"Flexible array member." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/flexible-array-member.

APA

encyclopegia.org. (2026). Flexible array member. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/flexible-array-member

Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Wide Quarter Video Graphics Array

stub · references available

aircrew member

stub · references available

Serpin family E member 1

stub · references available

Karl G. Jansky Very Large Array

stub · references available

Antarctic Muon And Neutrino Detector Array

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1362779318 · 0.5 · snapshot enwiki-001362779318

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.