Declaration names the box. Assignment fills it.
Declare means “please reserve a box and give it this name.” Assign means “write this value into that box.” They are two different jobs. This lesson does them on two separate lines so you can see each one.
int n;n = 42;%d and a newline.declare — the box exists but is empty
Reading n now would be undefined behavior.assign — write a value into the box
The name n now means 42.print the stored value
Output is 42.Each step highlights the matching C line. Program output appears only when a line that prints actually runs.
Five questions. Pick one answer each, then Check answers. The correct choice turns green.
1. What does int n; do by itself?
Declare without initialize.
2. Which line writes 42 into the box?
Assignment.
3. Why is assign-before-printf required?
Do not read uninitialized.
4. int n = 42; is:
Combined initialization.
5. %d is the format for:
Decimal int.