What is sizeof(struct StructT) equal to?
struct StructT {
    uint64_t fieldOne;
    uint8_t fieldTwo;
In this case, the size of the structure in memory is 16 bytes instead of 9, as one might suppose, because each structure "wants to be aligned" in the array, but the standard requires that the array items be "without holes" between them.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes