What If I have function return_num(), where I need return some value, but if I switch inserted value x, and I'm sure, that default will return value 1, if I enter anything else... Is necessary to add another return with value 1 to the end of function?
Compiler does not complain.
int return_num(int x) {
switch (x) {
case 0: return 10;
case 1: return 25;
case 2: return 33;
default: return 1;
}
// <--- necessary return?
}