It would make more sense that it aligned the odd chars on a DWORD boundary, though. At least to me.
Wild guessing: Presumably this is so, if someone like cus comes along who wants to copy one struct into another struct, and the struct that person is copying has just the two char arrays in it (and not everything else), then the alignments still match. After all, chars don't align on a DWORD.
Yes this is possible, bytes and byte arrays are aligned by definition, so no padding is required here, only objects greater than 1 byte (and accessed as such) have to be aligned.Nope, it's definitely (at least on this machine) 7+7+2+4.
Structure Padding is done to do memory alignment. As size of pointer is 4 bytes, if everything is organized by multiple of 4, that it will be easier and faster to calculate the address and processing them. Structure padding in C
Ok, we get it. Welcome to the forum. Now please stop bumping old threads with what you just learned today. (Based on ALL the other threads bumped).
I have deleted the other zombie posts.
*thread closed*
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)