In the following control structure which is faster?
1.Switch
2.If-else
and which consumes more memory?
Answer Posted / abhradeep chatterjee
According to me, switch is faster. cause in nested if-
else, the checking occurs in each step. So, more the
compiler checks, the more it takes time. So switch case is
faster.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How can I use a preprocessorif expression to ?
Can the size of an array be declared at runtime?
Explain the use of #pragma exit?
If the size of int data type is two bytes, what is the range of signed int data type?
What is a spanning Tree?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
What is the difference between fread buffer() and fwrite buffer()?
What are keywords in c with examples?
Why use int main instead of void main?
Can variables be declared anywhere in c?
How can I do serial ("comm") port I/O?
Explain what is the concatenation operator?
What is difference between union and structure in c?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
What is the use of define in c?