Size of Structure in C - Size of Structure in C Program
Learn c - c tutorial - Size of Structure in C Program - c examples - c programs
Size of Structure in C Program
- Size of the structure is 8 bytes on a 32-bit system in order that becomes multiple of 2 and it makes individual structures available at the correct byte boundaries once an array of structures is declared.
- This is achieved by padding the structure with 3 bytes at the end.
Sample Code
#include <stdio.h>
struct temp
{
};
int main()
{
struct temp T;
printf("Size of T: %d\n",sizeof(T));
return 0;
}
Output
Size of T: 0