Is a default case necessary in a switch statement? Ans. No, but it is not a bad idea to put default statements in switch statements for error- or logic-checking purposes. For instance, the following switch statement is perfectly normal: switch (char_code) { case 'Y': ...
See more
Download the Study24x7 App, so you can connect and collaborate.