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 type is sizeof?

0 Answers  


What is the difference between constant pointer and constant variable?

0 Answers   NIIT,


Explain how do you determine a file’s attributes?

0 Answers  


what is the maximum no. of bytes calloc can allocate

4 Answers   Mphasis,


Is there a built-in function in C that can be used for sorting data?

0 Answers  


What is the size of empty structure in c?

0 Answers  


What are runtime error?

0 Answers  


What is the difference between exit() and _exit() function in c?

0 Answers  


plz answer.... write a program that reads line (using getline) e.g."345", converts each line to an integer using "atoi" and computes the average of all the numbers read. also compute the standard deviation.

1 Answers  


explain what is fifo?

0 Answers  


f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=?

7 Answers   Geometric Software,


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.

0 Answers  


Categories