int main()
{
     int i=5;

     printf("%u",&i);

     return 0;
}

will the address which it will print is physical address of that variable or logical address ? I may not be clear in the defination of physical and logical address. thanks if you can help me ;)

It's a logical address.

I may not be clear in the defination of physical and logical address. thanks if you can help me ;)

Physical addresses are the actual spots in memory. Logical addresses are a set of pretend addresses assigned to each process that are mapped into physical addresses by the OS when the process is loaded. The benefit of logical addresses is that an executable can refer to specific addresses for things such as entry points and jumps without worrying about those addresses being unavailable at runtime. They're always available because they're not real.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.