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

write a C program : To find out the number of identical words in two files . the file name should be taken as command line argument .

1 Answers   Subex,


If input is 123 then how to print 100 and 20 and 3 seperately?

4 Answers  


a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

0 Answers   TCS,


What is return type in c?

0 Answers  


What does volatile do?

0 Answers  






How do we declare variables in c?

0 Answers  


What is spark map function?

0 Answers  


write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34

0 Answers  


What is the -> in c?

0 Answers  


Why c language is called c?

0 Answers  


What do you understand by normalization of pointers?

0 Answers  


c program to compute AREA under integral

0 Answers   Infosys,


Categories