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 are local static variables? How can you use them?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
Is r written in c?
What is an identifier?
What is integer constants?
Define VARIABLE?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
What is enumerated data type in c?
What was noalias and what ever happened to it?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
Define Spanning-Tree Protocol (STP)
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What is a rvalue?
What is calloc()?
What is the ANSI C Standard?