answersLogoWhite

0

%p is used in a printf statement to show the memory address value of a pointer. It does not show the address of the pointer itself. You can see this with the following program:

#include

int main(void){
int* p;
printf("p: %p x: %x x&: %x\n",p,p,&p);
}

This gave me the following output:

p: 0x33d6d0 x: 33d6d0 x&: bf9a8c10

So %p is a way of formatting the value in a pointer to make it obvious that you are referring to a memory location.

User Avatar

Wiki User

15y ago

What else can I help you with?