GeekInterview.com
  I am new, Sign me up!
 
Home C
 

What are the limitations with switch statement?

 
Category: C
Comments (-1)


Switch statement is a powerful statement used to handle many alternatives and provides good presentation for C program. But there are some limitations with switch statement which are given below:


Logical operators cannot be used with switch statement. For instance


case k>=20:


is not allowed


Switch case variables can have only int and char data type. So float or no data type is allowed.


For instance in the switch syntax given below:


switch(ch)
{
case 1:
statement-1;
break;
case 2:
statement-2;
break;
}


In this ch can be integer or char and cannot be float or any other data type.



Read Next: What happens when a variable is not declared in function definition?



 
Related Topics


 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape