From 9716cce895198c6c12badb421c286fe2853aa8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Fri, 1 Nov 2024 08:03:36 +0300 Subject: [PATCH] global and local variables --- ChangeLog | 2 ++ c-basic/global_local.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 c-basic/global_local.c diff --git a/ChangeLog b/ChangeLog index c92528c..5c75941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2024-11-01 Mert Gör + * c-basic/global_local.c: global and local variable + * c-basic/file_scope.c (foo): file scope example 2024-10-30 Mert Gör diff --git a/c-basic/global_local.c b/c-basic/global_local.c new file mode 100644 index 0000000..96ae321 --- /dev/null +++ b/c-basic/global_local.c @@ -0,0 +1,21 @@ +#include + +int a; + +void foo() +{ + int a; + + a = 10; +} + +int main() +{ + a = 20; + + printf("%d\n", a); + foo(); + printf("%d\n", a); + + return 0; +}