In the following control structure which is faster?
1.Switch
2.If-else
and which consumes more memory?
Answers were Sorted based on User's Feedback
Answer / battini.laxman
switch is faster because when in nested if condition has to
check for each time. where as in switch it diectly check
only labels.
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / 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 |
Answer / 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 |
Answer / deepak upadhyay
switch statement is more faster and consumes less memory
than if-else statement the reason being that the switch
statement is applied when we have a single variable to
check but in case of if-else different variable may be
checked at the same time.
| Is This Answer Correct ? | 1 Yes | 1 No |
1 What is a Data Structure?
Write a C++ program to give the number of days in each month according to what the user entered. example: the user enters June the program must count number of days from January up to June
write a program in c language to print your bio-data on the screen by using functions.
6 Answers College School Exams Tests, IBM,
What is the use of volatile?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Eight queens puzzle
What is the use of gets and puts?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
In CMM or CMMI certified organizations,we assess only the standard software processes of the organization. We do not assess the organizations other functional departments like HR or Admin. Then how can we certify the entire organization as CMM level company?? We have assessed only software related activities. Right. There is no relation with other departments like Accounts, HR or Admin. Then how can we claim that the whole company is a CMM certified company?
What is identifiers in c with examples?
What is an expression?
How can I read and write comma-delimited text?