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
Place the #include statement must be written in the program?
#include
Do you have any idea how to compare array with pointer in c?
What is pointer in c?
Explain the ternary tree?
Which is an example of a structural homology?
What is putchar() function?
What do mean by network ?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
write a program to find out prime number using sieve case?
Explain how do you determine a file’s attributes?
What are the advantages of using linked list for tree construction?
Describe dynamic data structure in c programming language?
What are register variables in c?