When I am using a pointer in C for a PC program, does it point to the physical or virtual address of the variable ?
int x = 10;
int* ptr = &x;
When I am using a pointer in C for a PC program, does it point to the physical or virtual address of the variable ?
int x = 10;
int* ptr = &x;
The question is irrelevant. If there is a virtual memory manager, then you can't see it, and if there is not, then you can't see that either.
If there is an underlying OS (not taking embedded systems into account), and it is not a special kind of low-level application (drivers, stacks), the address will always be virtual.
It depends.
If you're writing a application that will run on top of a operating system, that is, in user mode and the operating system uses virtual memory, it will point to a virtual address (or rather, it will point to a physical address but not the same physical address that will in fact be used).
If you're using an operating system without virtual memory or if you're writing (parts) of the kernel code it will point to the physical address.
It depends on your OS!
In Windows and Linux it's typical virtual memory! Also user space application canno't access the memory using physical addresses.