Quick Contact

✉
fahimkhan20148@gmail.com
📱
+971 507 286 133
Back to Notes
August 28, 2026
cmemorystructs

Flexible Array Member

A flexible array member is an unsized array declared as the last member of a struct to support contiguous variable-length payload allocation.

  • sizeof returns the size of the struct excluding the Flexible Array Member. Hence the need to add size * sizeof(type) in dynamic allocation.
  • The Flexible Array has to be the last member of the struct.
  • The Flexible Array can't be the only member of the struct.