The first if is not attached to the second, because there is no else tying them together. Which is fine, if that is really what you want to happen. The point of my posts is that you understand how to...
Type: Posts; User: quzah
The first if is not attached to the second, because there is no else tying them together. Which is fine, if that is really what you want to happen. The point of my posts is that you understand how to...
You have to think about what you want your program to do. Watch:
if( x == 1 )
printf( "x is one\n" );
else
if( x == 2 )
printf( "x is two\n" );
else
printf( "x is not one or two\n"...
if ... will always run this if check
if ... will always run this check
else
will only run if that was not trueCompare that with this:
if ... always runs this if check
else if ... only after...