Hello.I have the below program in C and I want your help to understand something.
Code:
What I have tried:
char x, s[5], *p = NULL;
int y, a[10], *q = NULL;p = &x;
q = a;
printf("char: %ld, int: %ld\n", sizeof(char), sizeof(int));
printf("x: %ld, y: %ld\n", sizeof(x), sizeof(y));
printf("s: %ld, a: %ld\n", sizeof(s), sizeof(a));
printf("p: %ld, q: %ld\n", sizeof(p), sizeof(q));
printf("*p: %ld, *q: %ld\n", sizeof(*p), sizeof(*q));
}
with output:
char: 1, int: 4
x: 1, y: 4
s: 5, a: 40
p: 8, q: 8
*p: 1, *q: 4
The only thing I can not understand why is happening is the p: 8, q: 8
64-bit system
Why?
Thanks.