The code
int b = 20
actually does two things:
int b
and
b = 20
The compiler sets the variable b when it compiles the program. This is an automatic variable that goes onto the stack. But he does not assign meaning to it until the execution of the program reaches this point.
Up to this point, it is not known what value the variable has.
This does not apply to a global variable or a static variable - they are initialized when the program starts.
source share