03. Variables & Data Types
Box wali analogy, int/char/float, format specifiers, live labs
Goals:
- Variable = named storage
int, float, char
printf format: %d %f %c
1. Variable kya hai? (simple)
Variable ek named box hai jisme value rakhte ho.
int age = 18; ka matlab:
• type = int (poora number)
• naam = age
• value = 18
Baad me age likhoge to computer us box ki value use karega.
2. Basic types
int — whole numbers (10, -3)
float — decimals (5.9)
char — single character ('A') — single quotes
Technical: type batata hai kitni memory reserve hogi aur value kaise interpret hogi.
Live practice 1 — Teen variables
Output me age, height, grade dikhne chahiye. Values change karke Run karo.
Live practice 2 — Calculation variable me
Sum variable me store karke print.
Best practice: meaningful names (age, total) — x1, t se better.