A switch statement , Computer Engineering

Which is more efficient, a switch statement or an if else chain?

Ans) The differences, if any, are likely to be small. The switch statement was designed to be efficiently implementable, though the compiler may want to use the equal of an if/else chain (as opposed to a compact jump table) if the case labels are sparsely distributed.

 

 

Posted Date: 4/8/2013 3:12:34 AM | Location : United States







Related Discussions:- A switch statement , Assignment Help, Ask Question on A switch statement , Get Answer, Expert's Help, A switch statement Discussions

Write discussion on A switch statement
Your posts are moderated
Related Questions
Q. Writing down your own Interrupt Service Routines? Here are a few rules which should be kept in mind while writing down your own Interrupt Service Routines: 1.  Use Int 21

What is finest way to get a reference to the viewport from anywhere in the code? Ans) You can use refs config to set a reference on the Application/Controllers

Method overloading is to overload methods using similar class name by writing different parameters. This is known as Method Overloading.

Q. Illustrate Internal Organisation of RAM? The construction displayed in Figure below is made up of one JK flip-flop and 3 AND gates. The two inputs to system are one input bi

Q. Explain Program Source Code? Program Source Code  Every assembly language statement appears as: {identifier}  Keyword {{parameter},}  {;comment}.   Element of a

Ameliorating the mechanical delays of seeks and rottion are usually regardeed as major aspects of device drivers for disks. The simplest way for a disk device driver to service dis

What is the purpose of IOP. The purpose of IOP is to given an independent path way for transfer of information among external and internal memory.

Q. What are cosmic rays? The ionising radiation several times stronger than γ-rays entering the earth from all the directions from cosmic or interstellar space is known as cosm

What is parsing? The target of parsing is to find out the syntactic validity of a source string. A tree is built for use through subsequent phase of compiler, if the string is

What is data hazard? Any condition that causes the pipeline to stall is known as a hazard. A data hazard is any condition in which either the source or destination operands of