Compilation error in IF statement
posted 7 years ago
An if-statement, and also all others like for, while etc, require a statement. Now "int b = 10;" is not a statement, it's a declaration. Using braces will work: it wraps all code inside the braces into one larger compound statement. And compound statements can have declarations.