scope examples

This commit is contained in:
Mert Gör
2024-10-30 09:04:32 +03:00
parent b8d2d91cd6
commit a96533946f
3 changed files with 21 additions and 2 deletions

19
c-basic/global_scope.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
int main()
{
int a;
a = 10;
{
int a;
a = 20;
printf("%d\n", a); // 20
}
printf("%d\n", a); // 10
return 0;
}

View File

@ -3,9 +3,7 @@
void foo()
{
int a;
{
int a;
}
}
int main()