void allocateMemory(int ** a)
printf("\nInt ** %p\nInt * %p\nInt %p",a,&a,*a);
printf("\nInt * %p\nInt %p",&t,t);
Int ** 0x124e010
Int * 0x7fffef9d1758
Int * 0x7fffef9d1778
If I'm guessing your intentions right, this:
Otherwise you're just assigning to the local
a (which will be thrown away) instead of storing to the
int * pointed by
Also, in the output you posted,
&t are not the same (even though they're close). They can't be the same since
t are different variables.
With the fix, you'll get the same output for
&t, just like you expected (you were corrupting
About digits: for
%p, C11 §18.104.22.168 8 says:
The value of the pointer is converted to a sequence of printing characters, in an implementation-defined manner.
So many possibilities exist. On many implementations it will print the hexadecimal address (16 digits for 64bit, 8 digits for 32bit). In your case, they appear shorter because the implementation omits leading zeroes and usually heap is at a lower memory location than stack.