Question: why padding is needed in struct?
Answer: Why do structs have padding? - Quora. In order to align the data in memory, one or more empty bytes (addresses) are inserted (or left empty) between memory addresses which are allocated for other structure members while memory allocation. This concept is called structure padding.