write a c program to check weather a particluar bit is set
or not?
Answer Posted / abdur rab
#include <stdio.h>
int main ()
{
int variable = 6;
int position = 3;
char array [2][10] = {"NOT SET", "SET"};
// check the wheather the second bit is set
printf ( "\n The bit is %s",
array [ ( variable & ( 1 << (
position - 1 ) ) ) / position ] );
return ( 0 );
}
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
When should a type cast not be used?
What are the disadvantages of external storage class?
What is the general form of #line preprocessor?
What are header files and what are its uses in C programming?
Explain what is the most efficient way to store flag values?
Does c have function or method?
Is swift based on c?
What is the right type to use for boolean values in c? Is there a standard type?
How variables are declared in c?
What does the error 'Null Pointer Assignment' mean and what causes this error?
What is %s and %d in c?
Explain output of printf("Hello World"-'A'+'B'); ?
What is the difference between constant pointer and constant variable?
When should we use pointers in a c program?
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.