local variable and global variable

This commit is contained in:
Mert Gör 🇹🇷 2024-10-30 08:10:50 +03:00
parent a7e3c96ae2
commit bf5b6647b9
Signed by: hwpplayer1
GPG Key ID: 03E547D043AB6C8F
2 changed files with 21 additions and 0 deletions

View File

@ -1,5 +1,7 @@
2024-10-30 Mert Gör <mertgor@masscollabs.xyz>
* c-basic/local_vs_global.c (main): local variable and global variable
* c-basic/C.pdf: page 24 scope
* c-basic/void.c (main): Void/Return

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

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