if I have a pointer to an integer such as:
int num = 12;
int *p = #
and then print the address so
printf("%p\n", (void*)p);
What is the difference between the previous and this:
printf("%p\n", (void*)&p);
Here, p
contains the address of num
, so the first printf
outputs the address of num
.
On the other hand, &p
is the address of p
, so the second printf
prints the address of p
.