in reply to Re^3: if/else syntax
in thread if/else syntax
There's actually no ambiguity in the C syntax for your example. The compiler understands it fine. The problem is that the programmer/reader of the code does not always read it the same way.
if(a) if(b) c(); else d();
According to what I recall, the else matches with the nearest if in this case. Unfortunately, indentation gives humans fits on this.
This does the same thing (else goes with if(b)). As I said, there's nothing ambiguous about it.