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...


how to set Nth bit of a variable?



how to set Nth bit of a variable?..

Answer / kirankumaryakkala

ex: int res=16, temp=1,n;
printf("enter the Nth bit no");
scanf("%d",&n);
temp=temp<<n; //leftshift to ntimes
res=res|temp; //bitwise OR
printf("setted nth bit of res %d",res);

Is This Answer Correct ?    9 Yes 4 No

Post New Answer

More C Interview Questions

What is the difference between text files and binary files?

0 Answers  


What is enumerated data type in c?

0 Answers  


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

0 Answers  


What does do in c?

0 Answers  


why effort estimation is important?

1 Answers  


What is the purpose of the preprocessor directive error?

0 Answers  


What is anagram in c?

0 Answers  


wap in c to accept a number display the total count of digit

4 Answers  


How is a null pointer different from a dangling pointer?

0 Answers  


How to implement call back functions ?

3 Answers   HP,


how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....

0 Answers  


What is && in c programming?

0 Answers  


Categories