In the following control structure which is faster?
1.Switch
2.If-else
and which consumes more memory?
Answer Posted / vignesh1988i
as for as me is concerned switch is faster....
in if-else first it will check the if condition , if it is
true it's no problem.. but if it falls false, it will go
to the else part ...
but in switch case , the argument given inside switch
statement will see and automatically to the necessary case
of it... so by comaring the time constraint ,switch saves
the time for checking each else statement for every if....
thank u
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is infinite loop?
What are the advantages of using Unions?
What is the difference between text and binary i/o?
What is meant by initialization and how we initialize a variable?
What are the data types present in c?
Why do we use c for the speed of light?
What are different types of variables in c?
Can the size of an array be declared at runtime?
How can I pad a string to a known length?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
code for quick sort?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
What does typedef struct mean?
Why calloc is better than malloc?
What is the difference between local variable and global variable in c?