At the beginning, you define two variables, a
and variable
. Note, that those variables at this point are not initialized. Right now, the compiler only knows that there are two variables of type int
and their names, nothing more.
You then try to initialize variable a
with the not initialized variable variable
, the result should be clear: The two variables remain uninitialized.
Then you proceed and initialize a
with 200
, variable
is still only defined, not initialized.
After that, you print the still uninitialized variable variable
, which hasn't recieved any "real" value as of yet, only what already was "lying around" in memory when the compiler assigned that memory location to the variable. In your case, that was "2" (or at least, that's what printf
could extract from there).
Further reading: C Variables. This explains how variables are defined, declared and initialized.