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; }

Answers were Sorted based on User's Feedback



what is the purpose of the code, and is there any problem with the code? int f( int n, int l, i..

Answer / 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

what is the purpose of the code, and is there any problem with the code? int f( int n, int l, i..

Answer / guest

first it will call to n and then it will move on l or r, if
it is less then or equal to is there so it will return the
value ..... or else it will print the output

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

What is function prototype in c with example?

0 Answers  


what are the advantage and disadvantage of recursion

5 Answers  


can u write a program in C, which does not use = (eqaul)or any arithmatic assignment(like -=,+=,*= etc) operator to swap to number?

2 Answers  


how logic is used

0 Answers  


Explain what math functions are available for integers? For floating point?

0 Answers  






Write a C program where input is: "My name is xyz". output is: "xyz is name My".

1 Answers   TCS,


how to find the given number is prime or not?

6 Answers   IMS, ING,


what is a constant pointer in C

0 Answers  


how to determine the complexity of an algorithm as log(n)

1 Answers   Google,


write a prgram of swapping with 2 valiables

6 Answers  


WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER

0 Answers  


What is a list in c?

0 Answers  


Categories