diff --git a/ChangeLog b/ChangeLog index 5ff6705..c92528c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2024-11-01 Mert Gör + + * c-basic/file_scope.c (foo): file scope example + 2024-10-30 Mert Gör * c-basic/C.pdf: Global variable scope page 26 diff --git a/c-basic/file_scope.c b/c-basic/file_scope.c new file mode 100644 index 0000000..6947037 --- /dev/null +++ b/c-basic/file_scope.c @@ -0,0 +1,18 @@ +#include + +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; +}