scope examples

This commit is contained in:
Mert Gör 🇹🇷 2024-10-30 09:04:32 +03:00
parent b8d2d91cd6
commit a96533946f
Signed by: hwpplayer1
GPG Key ID: 03E547D043AB6C8F
3 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,7 @@
2024-10-30 Mert Gör <mertgor@masscollabs.xyz>
* c-basic/C.pdf: Global variable scope page 26
* c-basic/scope.c (foo): same variable different scopes
* c-basic/C.pdf: page 25,end of the page

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()