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

Explain what does a function declared as pascal do differently?

646


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

669


What are the keywords in c?

647


What is difference between array and structure in c?

583


What is the difference between ā€˜gā€™ and ā€œgā€ in C?

2646






Explain the advantages and disadvantages of macros.

630


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

656


what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1909


how to count no of words,characters,lines in a paragraph.

3912


Why is structure important for a child?

607


What is the advantage of c?

613


Why we use void main in c?

601


Is struct oop?

588


Is main is user defined function?

601


Explain what is a pragma?

596