I am newbie to the C programming.I know this is a very simple question but I need some advice.
I am exercising with the control structure if statement
. I came across one example
Here is the code:-
#include<stdio.h>
int main()
{
int a = 200, b, c ;
if (a >= 300)
{
b = 100 ;
c = 200 ;
}
printf ( "b=%d\nc=%d", b, c ) ;
return 0;
}
And the output of this is :-
b=32767
c=0
Here i am expecting the output as the both value to be zero. By seeing this output i am little surprised that why the garbage value in the variable b
.
What is the reason behind that?Or I am declaring the variable in wrong way. what should the whole scenario behind this?