I am creating two structs in C that have the same number of variables: 3 integers and 3 chars. When i look at the size of an instance of each of the structs using the sizeof() operator i get two different values. I wonder Why is this happening, here is my code: I tried rearranging the variable with the same result.
typedef struct a
{
int x;
char a;
int y;
char b;
int z;
char c;
}s1;
typedef struct b
{
int x;
int y;
int z;
char a;
char b;
char c;
}s2;
int main()
{
printf("%d %d\r\n", sizeof (s1), sizeof (s2));
return 0;
}