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 / om

void toggle_kth_bit_IMPROVED(int *n, int bitToBeChanged)
{
*n=*n^(1<<(bitToBeChanged-1));
}

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the concatenation operator?

1149


How do you use a 'Local Block'?

1166


What is c definition?

1272


What is a #include preprocessor?

1149


What is meant by realloc()?

1138


What is a lookup table in c?

1118


Write a program to print fibonacci series without using recursion?

1134


Explain how can you tell whether a program was compiled using c versus c++?

1101


Is c procedural or functional?

1024


What is the meaning of typedef struct in c?

1065


Explain what are header files and explain what are its uses in c programming?

1154


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1523


What is the right type to use for boolean values in c?

1030


How can you find the day of the week given the date?

1198


Why is struct padding needed?

1083