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 advantage of c?
How do we open a binary file in Read/Write mode in C?
Can we access array using pointer in c language?
How does #define work?
What does c mean in basketball?
i want to know the procedure of qualcomm for getting a job through offcampus
What is a keyword?
How do you determine the length of a string value that was stored in a variable?
What is function prototype?
Why is a semicolon (;) put at the end of every program statement?
What are pointers? What are different types of pointers?
What is the right type to use for boolean values in c?
What is a stream in c programming?
Do you know what are bitwise shift operators in c programming?
What is the difference between null pointer and wild pointer?