Saved Bookmarks
| 1. |
What happens when a null pointer is converted into bool?(a) an error is flagged(b) bool value evaluates to true(c) bool value evaluates to false(d) the statement is ignoredThis question was posed to me in an internship interview.The query is from Booleans topic in division Types, Pointers, Arrays & Structures in C++ of C++ |
|
Answer» CORRECT choice is (C) bool value EVALUATES to false Easy explanation - A pointer can be implicitly converted to a bool. A nonzero pointer converts to TRUE and zero VALUED pointer converts to false. |
|