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
Does c have function or method?
what will be maximum number of comparisons when number of elements are given?
What is meant by type casting?
What is a stream water?
Apart from dennis ritchie who the other person who contributed in design of c language.
Explain how are 16- and 32-bit numbers stored?
What are keywords c?
What are enumerated types?
What are the characteristics of arrays in c?
What does %p mean c?
What is the difference between single charater constant and string constant?
What is %g in c?
Should I learn data structures in c or python?
Why do we write return 0 in c?
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?