-3

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?

Tripp Kinetics
  • 5,178
  • 2
  • 23
  • 37
Aluma Gelbard
  • 43
  • 1
  • 6

1 Answers1

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