Error: switch quantity not an integer in C
The switch statement only works with integral type of values/variables, integral types like integer, character.
The error switch quantity not an integer occurs if the value/variables passed in the switch statement is not either integer or character.
Example:
Output
How to fix?
Use only integral variables/values with the switch statement. In this example, we changed type of choice variable from float to int.
Correct code:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer