How are the specifiers %p and %Fp working in the following code?
void main()
{
int i=85;
printf("%p %Fp",i,i);
getch();
}
I am getting the o/p as 0000000000000055 0000000000000055
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If this is what you are asking, %p and %Fp print out a pointer, specifically the address to which the pointer refers, and since it is printing out a part of your computer’s architecture, it does so in Hexadecimal.
In C, you can cast between a pointer and an int, since a pointer is just a 32-bit or 64-bit number (depending on machine architecture) referring to the aforementioned chunk of memory.
And of course, 55 in hex is 85 in decimal.