Improve nested variable test.

Test that we can have two levels of local variables.
This commit is contained in:
Jack Palevich 2009-06-11 22:03:24 -07:00
parent b67b18f7c2
commit 61d22dc763
1 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,20 @@ int b() {
printf("b()\n");
}
int nested() {
int a;
printf("nested 0: a = %d\n", a);
a = 50;
printf("nested 1: a = %d\n", a);
{
int a;
printf("nested 2: a = %d\n", a);
a = 51;
printf("nested 3: a = %d\n", a);
}
printf("nested 4: a = %d\n", a);
}
int main() {
globCheck();
fwdCheck();
@ -45,5 +59,7 @@ int main() {
printf("main 3: a = %d\n", a);
h(30);
printf("main 4: a = %d\n", a);
nested();
printf("main 5: a = %d\n", a);
return 0;
}