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

Answer Posted / mathiyazhagan

Though both are Braching statements,The selection of
statement is depending on developers.for simple
comparisions,there is no need to SWITCH statement.switch
statement will not use to compare floating,String and
logical expressions.
we can also use switch statement to somple
comparisons ,though it not fair as following segments :
switch(a>b)
{
case 0 :
max=a;
break;
case 1 :
max=b;
break;
}
I want to conclude that if...else structure is more
flexible and reliable than switch statement.

Is This Answer Correct ?    29 Yes 25 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of clrscr?

602


What is typedef example?

623


What is the use of function overloading in C?

686


Why does this code crash?

623


write a progrmm in c language take user interface generate table using for loop?

1576






Do you know the difference between malloc() and calloc() function?

617


What is the ANSI C Standard?

782


Wt are the Buses in C Language

2755


What is the use of pointers in C?

627


What is boolean in c?

615


What’s a signal? Explain what do I use signals for?

614


Write programs for String Reversal & Palindrome check

601


What is the difference between a string and an array?

712


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

655


What does *p++ do?

593