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 is indirection in c?
How pointer is different from array?
What is static and volatile in c?
What is a structure in c language. how to initialise a structure in c?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.
Why main is not a keyword in c?
Is null equal to 0 in sql?
What are the uses of null pointers?
What does calloc stand for?
Can you define which header file to include at compile time?
How do you use a 'Local Block'?
Why c is called procedure oriented language?
is it possible to create your own header files?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop