top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What type of variable can not be passed in switch-case statement in C?

+1 vote
622 views
What type of variable can not be passed in switch-case statement in C?
posted Oct 2, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

0 votes

Variable of float data type cannot be passed as an expression in switch case.

answer Oct 2, 2014 by Aarti Jain
0 votes

Agree with Aarti. Just to add non-integral values can't be used with case.

answer Oct 2, 2014 by Harshita
0 votes

Switch-Case statement should have variable which are from int family only like int, uint, long int, long unsigned int, short int, short unsigned int, char, signed char and enum.

What is not allowed:
array (any type), float or float family (double)

answer Oct 2, 2014 by Salil Agrawal
...