write a c program to change only the 3rd bit of the
particular number such that other bits are not affected..
if bitnum=10(say.. it can be any no..

Answer Posted / binu

YOU CAN SET OR CLEAR THE THIRD BIT without changing other bits

#define BIT3 (0X01<<3)
void main()
{
int a;
//set the third bit of a
a|=BIT3;
//clear the third bit
a&=~BIT3;

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is type qualifiers?

653


What does dm mean sexually?

806


How many parameters should a function have?

661


What is the difference between c and python?

578


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

647






What is #define in c?

614


Is javascript based on c?

591


What are the advantages of c preprocessor?

708


how to create duplicate link list using C???

2069


What is the usage of the pointer in c?

598


What is void c?

560


formula to convert 2500mmh2o into m3/hr

491


difference between object file and executable file

6090


How can I swap two values without using a temporary?

610


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

739