I need some help with an issue I'm having.
I'm currently coding something via Visual Studio C++ 2010 Express where I have something similar to:
Now for my problem... I will run the program, but it will eventually unexpectedly end (Press any key to continue...).
At first I was completely puzzled as 'close' should have been 0 the entire time. I stuck a:
directly above
And I find that 'close' ends up being anywhere between 20-23 which is the exact same as another variable of a completely different name!
Using CTRL+F "close", the only results are whatever you see above. It is not used or changed in any way in the "bunch of code".
I'm not necessarily looking for a direct fix (I want to avoid pasting all of my code), but does anyone know a potential cause / explanation for this?
Thanks.
I'm currently coding something via Visual Studio C++ 2010 Express where I have something similar to:
Code:
// headers included
// bunch of declarations and initializations
int close = 0;
int _tmain(int argc, _TCHAR* argv[])
{
// code unrelated to 'close'
do
{
int menuInput = _getch();
switch(menuInput)
{
// bunch of code also unrelated to 'close'
case 'x':
close = 1;
break;
}while(close == 0);
return 0;
}
Now for my problem... I will run the program, but it will eventually unexpectedly end (Press any key to continue...).
At first I was completely puzzled as 'close' should have been 0 the entire time. I stuck a:
Code:
printf("%d\n",close);
Code:
return 0;
And I find that 'close' ends up being anywhere between 20-23 which is the exact same as another variable of a completely different name!
Using CTRL+F "close", the only results are whatever you see above. It is not used or changed in any way in the "bunch of code".
I'm not necessarily looking for a direct fix (I want to avoid pasting all of my code), but does anyone know a potential cause / explanation for this?
Thanks.