Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

0 Answers  


SRUCTURE PROGRAMMING

3 Answers   CTS, Wipro,


Without Computer networks, Computers will be half the use. Comment.

0 Answers  


I have seen function declarations that look like this

0 Answers  


Prove or disprove P!=NP.

5 Answers   Microsoft,


How can I find out if there are characters available for reading?

0 Answers  


What does nil mean in c?

0 Answers  


What is scanf () in c?

0 Answers  


How do I convert a string to all upper or lower case?

0 Answers  


what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);}

9 Answers   TCS,


what is the output of the following program? #include<stdio.h> void main() { float x=1.1; while(x==1.1) { printf("\n%f",x); x=x-0.1; } }

6 Answers  


Explain how can I open a file so that other programs can update it at the same time?

0 Answers  


Categories