How to retrieving variable value in C++ if you know the variable address

前端 未结 5 1685
别那么骄傲
别那么骄傲 2021-01-23 05:50

Greetings,

I have recently started to code in C++ and have come across a problem to which I was unable to find the answer, so I thought maybe somebody e

5条回答
  •  无人及你
    2021-01-23 06:00

    On today operating systems, the programs handle virtual addresses, not physical ones. Shortly, a specific address for one programs will not point to the same physical location for other programs.

    To do what you want on modern operating systems, you can, for instance, set up a shared memory location.

    But there is a lot of easier way to pass a value from one program to another.

    If you are just wondering that out of curiosity, that's a good question, you can look at what "virtual memory" is.

提交回复
热议问题