: What is a “dangling else”? How are else clauses resolved in C++
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:5| Question number:8
All Answers
total answers (1)
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:5| Question number:8
total answers (1)
A
"dangling `else`"means the ambiguity that an`else`may belong to several`if`. In C++, this is resolved by specifying that each`else`is matched with the closest preceding unmatched`if`.
need an explanation for this answer? contact us directly to get an explanation for this answer