Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the different between if-else and switch statment
(other than syntax)

Answer Posted / bakhtiar khan wazir

 
IF Statement: Checks the value of data is less than or greater than. (in ranges).
example: can tell wether an input age is more than 18 and less than 60.




Switch Case: Checks the value of data that is prespecified. only equal to. 




example: Can only generate output if the value matches. When the age is 18 or when the age is 60 . No comarison of data based on greater than or smaller than. Compares data based on equality.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is variable and explain rules to declare variable in c?

1181


Explain the ternary tree?

1079


Why do some versions of toupper act strangely if given an upper-case letter?

1117


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

2354


Hi can anyone tell what is a start up code?

2139


Why is c fast?

1122


What is wrong with this program statement?

1088


What is a macro?

1164


Why do we use & in c?

1052


which is an algorithm for sorting in a growing Lexicographic order

1867


Why structure is used in c?

1239


Is multithreading possible in c?

1070


Explain bitwise shift operators?

1320


.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }

1374


What is a struct c#?

1103