
- Forum
- Programming Talk
- C and C++
- hi all
hi all
This is a discussion on hi all within the C and C++ forums, part of the Programming Talk category; any one pls tell me about structure padding?...
-
hi all
any one pls tell me about structure padding?
-
Hi,
Struture padding main usage is for handling memory alignment. This concept is particularly useful when in a structure variables of different sizes need to be put together in which case a boundary size is fixed and structure padding applied in this.
Blenda
-
I have a rough idea about structure padding. It is adding of bits in structure of a C program internally. But I do not have idea about why is this added and how it gets added. I am waiting for someone to clarify this.
-
adrian you are right. Structure padding is addition of bits or padding bytes. In C we know that memory is allocated based on data type. That is for integer it is 2 bytes, for long 4 bytes and so on. Since structures are association of different data types to maintain byte boundary padding bytes takes place. This is the reason for structure padding.
-
Sponsored Ads

Reply With Quote





