I have used debug mode in Visual Studio before, but I never had to use the memory window. If I had a simple application that calculates a=b+c and made b =8 and c=-2, how can
One way to find the address of a variable in Visual Studio is to use the QuickWatch window (under the debug menu if you don't know the hot key, Ctrl + Alt + Q). If you type &a
, it will display the address of variable a
. You can then enter that address in the memory window. Or you could just enter &a
in the memory window.
But to see all variables with the memory window, they would need to be within a few bytes of each other since it shows contiguous memory. For local variables on the stack, that would not usually be a problem. For integer variables, you can more easily view them in a readable format by right clicking on the memory window and changing the layout (for example, choose 4-byte integers with a signed display).
Having said all that, it seems like it would be much simpler to use the watch window since everything is labeled nicely already and it is easy to tell which value is associated with which variable.