Default case provides switch statements with fallback, and in general is a good to have. Hence consider adding default case to switch.
int x = 10;
switch x {
case 1: {
printf("You chose 1.");
break;
}
case 2: {
printf("You chose 2.");
break;
}
}
int x = 10;
switch x {
case 1: {
printf("You chose 1.");
break;
}
case 2: {
printf("You chose 2.");
break;
}
default: {
printf("Invalid choice!");
break;
}
}