Hello folks,
The code (below) exhibits the following (strange) behavior:
WHEN AGE IS DECLARED AS A LOCAL VARIABLE IN MAIN:
1. program does not work as expected
2. "age" is not available in the debug watch window
WHEN AGE IS DECLARED AS A GLOBAL VARIABLE (JUST ABOVE MAIN):
3. program works as expected
4. "age" is available in the debug watch window
(Could this be because I am using Windows Vista?)
Any help is greatly appreciated.
Best Regards,
Chris
#include<stdio.h>
int main(void)
{
int age;
age = 18;
switch(age)
{
case 16 :
case 17 :
printf("Old enough to drive\n");
break;
case 18 :
case 19 :
case 20 :
printf("Old enough to vote\n");
break;
case 21 :
printf("Old enough to drink\n");
break;
}
return(0);
}