Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



In the following control structure which is faster? 1.Switch 2.If-else and which consumes more me..

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

In the following control structure which is faster? 1.Switch 2.If-else and which consumes more me..

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

In the following control structure which is faster? 1.Switch 2.If-else and which consumes more me..

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

In the following control structure which is faster? 1.Switch 2.If-else and which consumes more me..

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

Post New Answer

More C Interview Questions

How will you delete a node in DLL?

0 Answers   GrapeCity,


how many errors in c explain deply

0 Answers  


main() { char x; while(x=0;x<=255;x++) printf("\nAscii value %d Charater %c",x,x); }

2 Answers  


How can I automatically locate a programs configuration files in the same directory as the executable?

0 Answers  


What does the c in ctime mean?

0 Answers  


How can I increase the allowable number of simultaneously open files?

1 Answers   ABC,


What is sparse file?

1 Answers  


what is the difference between exit() and _exit() functions?

2 Answers  


How can you increase the allowable number of simultaneously open files?

0 Answers  


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

0 Answers   Wilco,


What are pointers in C? Give an example where to illustrate their significance.

0 Answers   Wipro,


int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give me the explanation.

15 Answers   Global Edge,


Categories