what is the purpose of the code, and is there any problem
with the code?

int f( int n, int l, int r )
{ return (n << l) >> r; }

Answer Posted / senthil

f returns (n * 2^(l-r))

n<<l => n * 2^l
(n<<l)>>r => (n * 2^l)/(2^r)=>(n * 2^(l-r))

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a struct c#?

595


can any one provide me the notes of data structure for ignou cs-62 paper

1694


Explain how can you avoid including a header more than once?

591


What is #line in c?

554


Write a code on reverse string and its complexity.

593






What is static identifier?

693


I need previous papers of CSC.......plz help out by posting them.......

1809


How do you declare a variable that will hold string values?

659


Why header file is used in c?

564


Explain how can you determine the size of an allocated portion of memory?

612


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

619


I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.

1731


Explain what does a function declared as pascal do differently?

630


Is c high or low level?

569


What is c definition?

735