Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This definition means that, when allocating storage space, only the first member, num, is considered. Consequently, the result of accessing the member data of a variable of type struct flexArrayStruct is undefined. DCL38-C. Use the correct syntax when declaring flexible array members describes the correct way to declare a struct with a flexible array member.

To avoid the potential for undefined behavior, structures that contain a flexible array member should always be accessed with a pointer as shown in the following code example.

...