Learn programming concepts interactively
Before exploring variables, predict: If you declare int age = 25
, what do you think happens in computer memory?
Think of computer memory as a neighborhood where each variable lives in its own house. Every house has a unique address (like 0x7fff1000) so the computer can find it instantly.
In C, every variable is a named memory location that stores data. Unlike higher-level languages, C requires you to explicitly declare the data type of each variable, which determines how much memory is allocated and how the data is interpreted.
Each variable has an address in memory (like a house address) and a value stored at that location. The type determines both the size and the interpretation of the stored bytes.
How much total memory do these three variables use: int age, float height, char initial?
🏘️ Each variable lives at a unique address in Memory City
🏠 House size depends on data type - bigger types need bigger houses!
No operations yet
Start by adding or modifying elements