Are there any size limitations for C structures?

Nemo picture Nemo · Oct 11, 2011 · Viewed 11.1k times · Source

Are there any size limitations for C structures?

Answer

Alexey Frunze picture Alexey Frunze · Oct 11, 2011

From the C standard:

5.2.4.1 Translation limits

1 The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits:

... — 65535 bytes in an object (in a hosted environment only)
... — 1023 members in a single structure or union
... — 63 levels of nested structure or union definitions in a single struct-declaration-list ... 13) Implementations should avoid imposing fixed translation limits whenever possible.

Other than that, the upper bound is SIZE_MAX (maximum value for size_t).