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 a volatile keyword in c?
Explain how can you be sure that a program follows the ansi c standard?
Is it fine to write void main () or main () in c?
What is chain pointer in c?
What is define c?
What is static and volatile in c?
write a program in c language to print your bio-data on the screen by using functions.
Explain main function in c?
What is #ifdef ? What is its application?
Can a pointer point to null?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
What is #line in c?
What are void pointers in c?
When should the register modifier be used? Does it really help?
What are structural members?