I started C++ recently and while learning switch case, I got this doubt.
What\'s the difference if I use int or char in the following code :
int Fav_Car;
Characters in switch cases are eventually converted to ASCII equivalent decimal i.e
char '1' - int 49
char '2' - int 50
For example, if input is integer int 1 , switch case will switch to default because 1 doesn't satisfy any case.
1 != 49
1 != 50
However, in case input is character char '1', output will be the first case as your desire.