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

how can f be used for both float and double arguments in printf? Are not they different types?

1081


What are the 5 organizational structures?

1038


Explain the red-black trees?

1141


Why does the call char scanf work?

1215


Why c is called a mid level programming language?

1084


Explain the difference between malloc() and calloc() function?

1060


write a program to print data of 5 five students with structures?

2057


Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3706


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

1224


Why is this loop always executing once?

1068


How can this be legal c?

1099


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

1152


How to find a missed value, if you want to store 100 values in a 99 sized array?

1415


Does c have circular shift operators?

1262


What are the 4 data types?

1030