file scope example
This commit is contained in:
parent
a96533946f
commit
293bc9b7ec
@ -1,3 +1,7 @@
|
|||||||
|
2024-11-01 Mert Gör <mertgor@masscollabs.xyz>
|
||||||
|
|
||||||
|
* c-basic/file_scope.c (foo): file scope example
|
||||||
|
|
||||||
2024-10-30 Mert Gör <mertgor@masscollabs.xyz>
|
2024-10-30 Mert Gör <mertgor@masscollabs.xyz>
|
||||||
|
|
||||||
* c-basic/C.pdf: Global variable scope page 26
|
* c-basic/C.pdf: Global variable scope page 26
|
||||||
|
18
c-basic/file_scope.c
Normal file
18
c-basic/file_scope.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int a;
|
||||||
|
|
||||||
|
void foo()
|
||||||
|
{
|
||||||
|
a = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
a = 20;
|
||||||
|
printf("%d\n", a); // a = 20;
|
||||||
|
foo();
|
||||||
|
printf("%d\n", a); // a = 10
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user