views:

31

answers:

1

why can't I see the variable 'x' in memory window of VS2005 while stepping the code using debugger?

int main()
{
   char *c = "String"; //visible
   char x = 'a'; // not visible
}
+2  A: 

Both are visible in the memory window. For example in the memory window in the address field type &x and then you will see the character code of the char in hex.

For example if you have:

char x = 'x';

Then in the memory window you type &x you will see the number 0x78 which is in base10 the number 120.

assert('x' == 0x78); 

Characters are just numbers.

By the way maybe you're looking for the watch window (where you can type in any value or expression and have it evaluated for you) or locals window (which shows you all of the variables that are visible to the current scope).

Brian R. Bondy