Category: Tutorials

Size of Structures

In this programming tutorial we will see that 2 structures with the same elements but with different arrange of elements make a different size of structure. Look at these structures:struct st1{    bool b1;    int i1;    char c1;    bool b2;    int i2;}; struct st2{    bool b1;    bool b2;    char c1;    int i1;    int i2;}; st1 works the same as st2 in C/C++, but the size of these structures isdifferent, because of the size of the data packing. Look […]

Back To Top