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

Answer Posted / ananth kumar

switch has its own pros and cons,

Favours coding style.
From performance point, switch case creates table. It
directly jumps to the required location based on table
contents.

If-else is hard for code-walk
Optimised (please check).

Is This Answer Correct ?    44 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are multidimensional arrays?

656


What is the 'named constructor idiom'?

636


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1314


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

627


How arrays can be passed to a user defined function

572






What are the advantages and disadvantages of c language?

556


What the advantages of using Unions?

669


develop algorithms to add polynomials (i) in one variable

1736


What is the collection of communication lines and routers called?

608


What is hash table in c?

569


Is there a way to compare two structure variables?

615


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

1862


What is the difference between the expression “++a” and “a++”?

648


What are different storage class specifiers in c?

611


What are the different types of objects used in c?

569