that's my first question on stackoverflow. I was reflecting on how arrays and names of arrays work and i got a doubt. I'm wondering why the address of an array name, and the address that he points to is the same. Moreover, why if i try to extrat the value at the addres pointed he returns me 0x1 and not the address itself.
Thats the code, thanks to anyone who answers.
int x[5]={1,2,3,4,5};
int y;
printf("%p %p\n", &x, x);
printf("%p %p\n", &x[0], x);
printf("%p %p", x[0], *x);
return 0;
Thats the output on CodeChef:
0x7ffc7bfa3a70 0x7ffc7bfa3a70n
0x7ffc7bfa3a70 0x7ffc7bfa3a70
0x1 0x1