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

Explain what is wrong with this statement? Myname = ?robin?;

1594


how can use subset in c program and give more example

2002


a program that can input number of records and can view it again the record

1920


How is = symbol different from == symbol in c programming?

1055


What is scope rule in c?

1077


What is uint8 in c?

1114


Are the variables argc and argv are local to main?

1324


How does free() know explain how much memory to release?

1066


What is the difference between #include and #include 'file' ?

1072


What are the characteristics of arrays in c?

1056


write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

2109


List the different types of c tokens?

1077


Can include files be nested? How many levels deep can include files be nested?

1178


What is difference between %d and %i in c?

1248


What is indirection? How many levels of pointers can you have?

1153