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
What is ## preprocessor operator in c?
What is the difference between volatile and const volatile?
What is a function in c?
explain how do you use macro?
What is masking?
Why is this loop always executing once?
What is operator precedence?
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if
can any one provide me the notes of data structure for ignou cs-62 paper
how many key words availabel in c a) 28 b) 31 c) 32
What is the function of multilevel pointer in c?
What are void pointers in c?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Can 'this' pointer by used in the constructor?