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

write a c program to change only the 3rd bit of the
particular number such that other bits are not affected..
if bitnum=10(say.. it can be any no..

Answer Posted / binu

YOU CAN SET OR CLEAR THE THIRD BIT without changing other bits

#define BIT3 (0X01<<3)
void main()
{
int a;
//set the third bit of a
a|=BIT3;
//clear the third bit
a&=~BIT3;

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by dynamic memory allocation in c? What functions are used?

1161


What is the difference between struct and union in C?

1304


Suggesting that there can be 62 seconds in a minute?

1044


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

1124


Explain can you assign a different address to an array tag?

1047


what is a constant pointer in C

1153


What is a header file?

1078


Why we use conio h in c?

1222


What does %d do?

1271


How can I do peek and poke in c?

1074


What is the difference between array and linked list in c?

1148


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2689


Explain what are multibyte characters?

1185


When we use void main and int main?

1075


Describe explain how arrays can be passed to a user defined function

1094