Scope of variables in C
📖 Scenario: Imagine you are writing a small C program to understand how variables behave inside and outside functions.
🎯 Goal: You will create a program that shows how variables declared inside a function are different from variables declared outside it.
📋 What You'll Learn
Create a global variable named
count with value 10Create a function named
showCount that declares a local variable named count with value 5Inside
showCount, print the local countOutside the function, print the global
count💡 Why This Matters
🌍 Real World
Understanding variable scope helps avoid bugs when different parts of a program use the same names.
💼 Career
Knowing scope is essential for writing clear and correct code in any programming job.
Progress0 / 4 steps