I have a structure and I wrote the following code to print the size of the structure. I get "8" as the size of structure though I was expecting "6" . sizeof(int)+sizeof(char)+sizeof(char) = 4+1+1 = 6. And If I comment the int part of structure I get the desirable result (i.e size of structure as 2)
I also printed out the size of int which is coming 4.
typedef struct example
{
int one;
char two;
char three;
}example;
int main()
{
printf("value %d %d ",sizeof(example),sizeof(int));
}