I have a question about the order of variable being stored in this small program.
void foo(int a0) {
printf("%#x, %d\n", &a0, a0);
int l0 = a0;
if (a0 > 0) {
foo(a0-1);
}
printf("%d\n", l0);
}
I have that the output being:
0xafe809fc, 3 // why address of 3 is higher than 2, 1, and 0?
0xafe809cc, 2
0xafe8099c, 1
0xafe8096c, 0 // shouldn't 0 get the higher address since 3 seems to be the first input too f00, then 2, then 1, then 0. So shouldn't the address order be the other way around?
0
1
2
3
my question is about why the address of 0 is higher than 1, 2, 3? shouldn't the order be the other way around?
also I think an int is 4 bytes, so why the address-distance is apart by 48 bytes? like for example address at 3 is 0xafe809fc, and address at 2 is 0xafe809cc. So the difference is 48 bytes apart? So it means int takes up 48 bytes in here?
could someone explains?
Oh I forgot to say that I call the function with the parameter a0 =3:
foo(3)
thanks