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

Does c have function or method?

993


what will be maximum number of comparisons when number of elements are given?

1902


What is meant by type casting?

1052


What is a stream water?

1211


Apart from dennis ritchie who the other person who contributed in design of c language.

1394


Explain how are 16- and 32-bit numbers stored?

1266


What are keywords c?

1027


What are enumerated types?

1185


What are the characteristics of arrays in c?

1049


What does %p mean c?

1063


What is the difference between single charater constant and string constant?

1086


What is %g in c?

1078


Should I learn data structures in c or python?

1018


Why do we write return 0 in c?

1049


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1637