scope examples
This commit is contained in:
parent
b8d2d91cd6
commit
a96533946f
@ -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
19
c-basic/global_scope.c
Normal 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;
|
||||
}
|
@ -3,9 +3,7 @@
|
||||
void foo()
|
||||
{
|
||||
int a;
|
||||
{
|
||||
int a;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user