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

#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }

1240


What is extern storage class in c?

942


What does it mean when the linker says that _end is undefined?

1039


what is recursion in C

1018


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

1382


Which one would you prefer - a macro or a function?

1033


How can I run c program?

1125


What oops means?

932


What is signed and unsigned?

1013


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4621


Why is a semicolon (;) put at the end of every program statement?

1029


What is the process of writing the null pointer?

980


What is identifier in c?

965


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

996


Which function in C can be used to append a string to another string?

1176