I saw that when I checked the size of struct it took 36 bytes, but the same variables (without the struct) took 33 bytes. Why?
Asked
Active
Viewed 363 times
-3
-
1Probably some padding taking place. Post an example – Lews Therin Jan 28 '15 at 17:13
-
2Can you show examples of both? – Mike Christensen Jan 28 '15 at 17:13
1 Answers
2
sizeof(struct) >= sum of all the structure members.
Because there might be extra padding for alignment requirements.That is the reason you are seeing that the size of the struct is more than what you thought.

Gopi
- 19,784
- 4
- 24
- 36