global and local variables
This commit is contained in:
parent
293bc9b7ec
commit
9716cce895
2 changed files with 23 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
2024-11-01 Mert Gör <mertgor@masscollabs.xyz>
|
||||
|
||||
* c-basic/global_local.c: global and local variable
|
||||
|
||||
* c-basic/file_scope.c (foo): file scope example
|
||||
|
||||
2024-10-30 Mert Gör <mertgor@masscollabs.xyz>
|
||||
|
|
21
c-basic/global_local.c
Normal file
21
c-basic/global_local.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int a;
|
||||
|
||||
void foo()
|
||||
{
|
||||
int a;
|
||||
|
||||
a = 10;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
a = 20;
|
||||
|
||||
printf("%d\n", a);
|
||||
foo();
|
||||
printf("%d\n", a);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue