what is %p format specifier indicates in the printf statement?

J

jayapal

Hi all,

what is %p format specifier indicates in the printf statement?

regards,
Jay
 
J

Joachim Schmitz

jayapal said:
Hi all,

what is %p format specifier indicates in the printf statement?
it is to print a pointer. The format of that isn't specified in the standard

Bye, Jojo
 
S

santosh

jayapal said:
Hi all,

what is %p format specifier indicates in the printf statement?

It's purpose is to print a pointer value in an implementation defined
format. The corresponding argument must be a void * value.
 
V

vipvipvipvipvip.ru

The value of the void * object will be converted to a sequence of
printing characters, in an implementation-defined way.

To be realistic, most implementations use a hexademical string
representation of the value.
 
J

jayapal

it is to print a pointer. The format of that isn't specified in the standard

Bye, Jojo

pointer in the sense the address of the variable?
Is %u and %p are same?
 
A

Army1987

pointer in the sense the address of the variable?
It has to be a pointer to void. You can convert an address into
one with a cast:
printf("%p\n", (void *)&var);
Is %u and %p are same?
No. %u is for printing an unsigned int in decimal.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top