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
How do you override a defined macro?
Can you assign a different address to an array tag?
plz let me know how to become a telecom protocol tester. thank you.
What does %d do?
Differentiate between ordinary variable and pointer in c.
How do we open a binary file in Read/Write mode in C?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
Is c weakly typed?
Whats s or c mean?
write a c program for swapping two strings using pointer
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Explain what is the concatenation operator?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
Explain what are the advantages and disadvantages of a heap?