How we can set and clear bit in a byte using macro function?
Answer Posted / sunitha
take i=5;
print its binary value
now for setting a bit
i=i>>5|1;
this will set 5th bit in binary value of 5
now for clearing a bit
i=i>>5 xor 1
this will clear 5th bit in binary value of 5
| Is This Answer Correct ? | 6 Yes | 3 No |
Post New Answer View All Answers
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
What is a dynamic array in c?
Can we use visual studio for c?
What are local variables c?
What library is sizeof in c?
What is union and structure?
What is a pointer variable in c language?
Why isn't it being handled properly?
What are 3 types of structures?
Explain what are header files and explain what are its uses in c programming?
What is difference between static and global variable in c?
Which is better between malloc and calloc?
What is data type long in c?
What is wrong with this statement? Myname = 'robin';
How are variables declared in c?