#include<stdio.h>
int main()
{
int a;
printf(" %u ",&a);
return 0;
}
The address we get is the virtual address of the process or the physical address when the process is running in main memory. Please help I am confused !!
If you run the program on a system with virtual memory, you will get a virtual address. If you run on a system without virtual memory (typically smaller embedded systems), you will get a physical address.
Also note that the format "%u"
is wrong for pointers, if you want to use printf
to print a pointer you should use "%p"
. See e.g. this reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With