what is the different between if-else and switch statment
(other than syntax)
Answer Posted / sujith
I would like to answer this question from a compiler
perspective. When we have if else or if else tree, we have
many compare instructions ( assembly generated by compiler)
where as switch has only one compare and jump instruction.
If the idea is to does something after comparing the values,
it is always better to go with the switch case than if else
tree.
I would appreciate analyzing the assembly code, with the
same source, with if else tree and switch case statements.
| Is This Answer Correct ? | 58 Yes | 33 No |
Post New Answer View All Answers
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What do you mean by c what are the main characteristics of c language?
What is the translation phases used in c language?
write a program in c language to print your bio-data on the screen by using functions.
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Can you explain the four storage classes in C?
Describe the order of precedence with regards to operators in C.
What is bin sh c?
What are reserved words with a programming language?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
how to introdu5ce my self in serco
Which is the memory area not included in C program? give the reason
What does void main return?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
write a c program for swapping two strings using pointer