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
What is the use of clrscr?
What is typedef example?
What is the use of function overloading in C?
Why does this code crash?
write a progrmm in c language take user interface generate table using for loop?
Do you know the difference between malloc() and calloc() function?
What is the ANSI C Standard?
Wt are the Buses in C Language
What is the use of pointers in C?
What is boolean in c?
What’s a signal? Explain what do I use signals for?
Write programs for String Reversal & Palindrome check
What is the difference between a string and an array?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What does *p++ do?