Diffrence of %x and %p | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Diffrence of %x and %p

/* in %p there are some extra figures. What are those for?*/ #include <stdio.h> int main() { int var=0; printf(" %p",&var); printf("\n %x",&var); return 0; }

19th Jan 2020, 8:22 AM
Elijah
Elijah - avatar
1 Answer
+ 3
%p is meant for pointer, depending on implementation, it may or may not output the number with hexadecimal notation '0x'. You can also see the hexadecimal notation using %#x format. https://stackoverflow.com/questions/28716220/why-is-the-format-of-p-and-x-different-in-a-format-string P.S. Add relevant language in your question tags to improve context clarity 👍
19th Jan 2020, 9:02 AM
Ipang