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 variable by using MACRO

Answer Posted / kirankumaryakkala

#define set(val,n) val|=1<<n //do left-shift then bitwise OR

logic is val|=1<<n
means,
first shift the value 1 to ntimes and do the bitwise or with
value.
u will get the answer

Is This Answer Correct ?    30 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are types of functions?

1032


How do you use a pointer to a function?

1077


What are the two forms of #include directive?

1158


Why do we use main function?

1173


What is union in c?

1115


What is the code for 3 questions and answer check in VisualBasic.Net?

2153


program to convert a integer to string in c language'

2451


How are pointers declared in c?

1057


Explain what is a static function?

1101


How can I do graphics in c?

1028


What is function prototype in c language?

1027


How can you be sure that a program follows the ANSI C standard?

1598


What are local static variables?

1144


Which are low level languages?

1089


What is a built-in function in C?

1589