From 9292974a16d0e7c5d68d646c3e504630fbf18559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Wed, 17 Jul 2024 16:54:04 +0300 Subject: [PATCH] Global variable example --- c-basic/global_variable.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 c-basic/global_variable.c diff --git a/c-basic/global_variable.c b/c-basic/global_variable.c new file mode 100644 index 0000000..8add6ea --- /dev/null +++ b/c-basic/global_variable.c @@ -0,0 +1,16 @@ +#include + +int a; + +void foo(){ + a = 10; +} + +int main(){ + a = 20; + printf("%d\n", a); // 20 + foo(); + printf("%d\n", a); // 10 + + return 0; +} \ No newline at end of file