3 ms·
Since you don't actually access the size of the structure, I see no reason why it matters. Also, FWIW, your code has undefined behavior because you call printf
by saagarjha 8y ago
Since you don't actually access the size of the structure, I see no reason why it matters. Also, FWIW, your code has undefined behavior because you call printf with the wrong type.
- klingonopera 8y agoYes on the UB, I'm passing a "char" into a "char *", sorry about that. I don't pass lone char data that often. Well, I chose this example specifically to ask whether the resulting memory structure, completely independent of calling a sizeof(), would still be as if I were to call a sizeof() (which then I believe would be 4 bytes large) if not accessing the total size of the struct or any of the padding members. It makes a difference in the memory footprint, which can become important, if you're programming a device with just 64-bytes total RAM.