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...

what is the different between if-else and switch statment
(other than syntax)

Answer Posted / sujith

I would like to answer this question from a compiler
perspective. When we have if else or if else tree, we have
many compare instructions ( assembly generated by compiler)
where as switch has only one compare and jump instruction.
If the idea is to does something after comparing the values,
it is always better to go with the switch case than if else
tree.

I would appreciate analyzing the assembly code, with the
same source, with if else tree and switch case statements.

Is This Answer Correct ?    58 Yes 33 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what type of questions arrive in interview over c programming?

2025


What are data types in c language?

1055


Can main () be called recursively?

1116


What is sizeof c?

1070


What is openmp in c?

1022


What are different types of pointers?

1068


How can you find the exact size of a data type in c?

1000


What is the code for 3 questions and answer check in VisualBasic.Net?

2156


How to establish connection with oracle database software from c language?

2197


Is stack a keyword in c?

1078


What is exit() function?

1012


What is boolean in c?

1088


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1685


How can I change the size of the dynamically allocated array?

1149


Explain what are reserved words?

1101