CHAPTER 04 / 26
C Variables
Learn how variables store data and how to declare and use them.
01 — Syntax
data_type variable_name = value;
02 — Example
#include <stdio.h>
int main() {
int age = 20;
printf("Age = %d", age);
return 0;
}03 — Important Points
- Choose meaningful variable names.
- Initialize variables before using them.
- A variable has a type and a value.
04 — Common Mistakes
- Using a variable before initialization.
- Using an invalid variable name.
05 — Real-World Use
Variables are used everywhere: counters, settings, sensor readings, prices and application state.
06 — Practice
Create a small program that demonstrates the main idea of C Variables.