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
Is it valid to address one element beyond the end of an array?
What are the advantages and disadvantages of c language?
What are the keywords in c?
What is 2c dna?
What are different types of operators?
How arrays can be passed to a user defined function
What is return in c programming?
What does & mean in scanf?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
How to set file pointer to beginning c?
Can the size of an array be declared at runtime?
How many types of sorting are there in c?
What does 3 mean in texting?
What does d mean?
What is void main () in c?