if (expression) t_statement [else f_statement]The conditional expression is evaluated, and if its value is nonzero the t_statement is executed. Otherwise the f_statement is executed in case there is an else clause.
An else clause is always matched to the last encountered if without an else. If this is not what you want, you need to use braces to group the statements, as in
if (a == 1) { if (b == 1) printf("a == 1 and b == 1\n"); } else printf("a != 1\n");
Index | Copyright © 2005 CadSoft Computer GmbH |