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
What does the function toupper() do?
What is infinite loop?
What is a sequential access file?
What functions are used for dynamic memory allocation in c language?
Tell us bitwise shift operators?
What is c method?
What is the difference between abs() and fabs() functions?
Explain what math functions are available for integers? For floating point?
How can you find the day of the week given the date?
Write program to remove duplicate in an array?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What is const volatile variable in c?
Can we add pointers together?
What is hash table in c?
How would you rename a function in C?