← C Programming learning pathC Programming · Module 2 of 10
Variables, data types and I/O
Store values in typed variables and read input with scanf.
📖 Key ideas
- Common types: int (whole numbers), float/double (decimals), char (one character).
- Declare before use: int age = 20;
- printf uses format codes: %d int, %f float, %c char, %s string.
- scanf("%d", &age); reads a number into age (note the &).
- sizeof(int) tells the size in bytes.
💡 Real-life example: Data types are containers of fixed sizes: a cup (char), a bottle (int), a jug (double).
intWhole number type
charSingle character type
%dFormat code for int
&Address-of operator used with scanf