In this simple C++ program:
int main() {
int n = 0xffffff12;
static int q = 0x7fffffff;
static int r = 0x10000000;
static int R = 0x80000000;
return 0;
}
I can retrieve the actual memory location of variable n
in Visual Studio Community debugger by looking at the assembly instruction in disassembly, getting the offset from that instruction, and adding it to the base pointer (EBP
).
But since static variables are allocated on program startup, how would I get their memory locations in the Visual Studio Debugger?
User contributions licensed under CC BY-SA 3.0