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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of f in c?

934


Where are c variables stored in memory?

1023


What is strcpy() function?

1086


What does int main () mean?

959


Explain what is a static function?

1047


Explain how can you avoid including a header more than once?

1041


How do you sort filenames in a directory?

1124


c program to compute AREA under integral

2336


What is the default value of local and global variables in c?

983


Can include files be nested?

1059


What is the use of structure padding in c?

1014


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

1917


What are the different data types in C?

1146


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

1054


Is c easier than java?

999