how to set Nth bit of variable by using MACRO
Answer Posted / sunitha
/* macro to set Nth bit */
#define SET_N_BIT(x,n) x|((~(unsigned)0)>>(8-(n-n-1))<<n);
Try out this . this is optimised version for setting a bit
work for any bit upto 8 bits if u want for 32 bits than
replace 8 with 32.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Explain the use of keyword 'register' with respect to variables.
What is methods in c?
What are nested functions in c?
Write a program to reverse a given number in c language?
What are global variables and how do you declare them?
What is meant by int main ()?
What is gets() function?
what are the advantages of a macro over a function?
How can you find the exact size of a data type in c?
What does 3 mean in texting?
How is pointer initialized in c?
why we wont use '&' sing in aceesing the string using scanf
Sir i need notes for structure,functions,pointers in c language can you help me please
Write programs for String Reversal & Palindrome check
What are enums in c?