How it works...
A structure is defined by the name customers, which consists of a few members. The members of the structure are of different data types. A compile-time assert is defined that places a constraint on the size of the customers structure to be of 28 bytes exactly. That means the program will not be compiled if the size of the structure is less than or greater than 28 bytes. The main function simply displays the size of different data types such as int, float, and char. The program also displays the size of the complete customers structure.
The program is compiled using GCC, as shown in the following screenshot. Because the size of the customers structure is exactly the same as that specified in the compile-time assert, the program ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access