Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

When should a type cast not be used?

1109


What are the disadvantages of external storage class?

1105


What is the general form of #line preprocessor?

1039


What are header files and what are its uses in C programming?

1337


Explain what is the most efficient way to store flag values?

1272


Does c have function or method?

1062


Is swift based on c?

1151


What is the right type to use for boolean values in c? Is there a standard type?

1061


How variables are declared in c?

1105


What does the error 'Null Pointer Assignment' mean and what causes this error?

1259


What is %s and %d in c?

1107


Explain output of printf("Hello World"-'A'+'B'); ?

1561


What is the difference between constant pointer and constant variable?

1280


When should we use pointers in a c program?

1196


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.

2309