In the context of “break” and “continue” statements in C, pick the best statement.
(A) “break” can be used in “for”, “while” and “do-while” loop body.
(B) “continue” can be used in “for”, “while” and “do-while” loop body.
(C) “break” and “continue” can be used in “for”, “while”, “do-while” loop body and “switch” body.
(D) “break” and “continue” can be used in “for”, “while” and “do-while” loop body. But only “break” can be used in “switch” body.
(E) “break” and “continue” can be used in “for”, “while” and “do-while” loop body. Besides, “continue” and “break” can be used in “switch” and “if-else” body.
Answer: (D)
Explanation: As per C standard, “continue” can be used in loop body only. “break” can be used in loop body and switch body only. That’s why correct answer is D.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.