Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which location address in a pointer refers to

What does the address in a pointer refer to, real address location in main memory or virtual address. Can it be configured.

And if it refers to virtual address , does Memory manager needs to convert this address to real address everytime it is accessed

like image 811
Sirish Avatar asked Nov 27 '25 16:11

Sirish


2 Answers

This depends on your system and OS.

For a typical windows/linux user space application, the address is a virtual memory address. User space applications have no way of accessing the memory using physical addresses - that's one of the abstractions the OS gives each process.

The MMU(Memory management unit) does this translation for every memory access, and it's up to the OS to set up the corect mapping for your process.

like image 161
nos Avatar answered Nov 29 '25 06:11

nos


If your system uses VM, then the address is virtual, if it doesn't, it isn't. This has nothing to do with either C or C++.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!