"Dangling else" discussion grabbed from the Web ---------------------------------------------------- There are some problems with multiple if's. Consider this: int a;b; a=3; b=2; if (a==3) if (b==3) a=0; else a=1; printf ("a=%d.",a); So what is printed out? This situation is called a dangling else, because it is difficult to know to which if statement the else belongs. If it belongs to the first if, a would still equal 3 at the end of the program. If, however, the else belongs to the second if, a would be changed to 1. Confusing, huh. Well, as a matter of fact, a dangling else sticks with the closest if, which is the second one. It is, however, possible to avoid dangling elses all together by using squiggly brackets on all ifs, like this: if (a==3) { if (b==3) { a=0; } else { a=1; { } Now it's a little more obvious what will happen. While the extra squiggly brackets are not required, they are immensely helpful and help to prevent bugs in the program.