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?

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


Please Help Members By Posting Answers For Below Questions

What is infinite loop?

1092


What are the advantages of using Unions?

1121


What is the difference between text and binary i/o?

1057


What is meant by initialization and how we initialize a variable?

1053


What are the data types present in c?

1166


Why do we use c for the speed of light?

1215


What are different types of variables in c?

1080


Can the size of an array be declared at runtime?

1088


How can I pad a string to a known length?

1038


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

1004


code for quick sort?

2042


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.

2060


What does typedef struct mean?

1116


Why calloc is better than malloc?

1041


What is the difference between local variable and global variable in c?

1237