What is dangling else problem in c on campus?
Answers
Answered by
0
When there are many nested if statements but having only one else statement, then it is a case of dangling else statement.
There could be confusion regarding to which if , the else statement belongs.
if (expr1)
if (expr2)
if (expr3)
else stmnt.
Normally it belongs to the innermost. But it depends on the language grammar definition. It is better to put { } to clearly indicate the nesting.
There could be confusion regarding to which if , the else statement belongs.
if (expr1)
if (expr2)
if (expr3)
else stmnt.
Normally it belongs to the innermost. But it depends on the language grammar definition. It is better to put { } to clearly indicate the nesting.
kvnmurty:
:-)
Answered by
10
Explanation:
Dangling else. The dangling else is aproblem in computer programming in which an optional else clause in an if–then(–else) statement results in nested conditionals being ambiguous.
Similar questions
History,
8 months ago
Political Science,
8 months ago
Computer Science,
8 months ago
Math,
1 year ago