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

Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

658


Explain how do you declare an array that will hold more than 64kb of data?

904


How can a number be converted to a string?

607


Explain null pointer.

622


What is a pointer and how it is initialized?

609






What is the difference between char array and char pointer?

527


write a program to create a sparse matrix using dynamic memory allocation.

4373


Can a variable be both const and volatile?

676


What is ponter?

774


largest Of three Number using without if condition?

1009


Does * p ++ increment p or what it points to?

618


What does the message "automatic aggregate intialization is an ansi feature" mean?

694


What do header files do?

603


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

920


Is stack a keyword in c?

637