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...

What is the most efficient way to count the number of bits
which are set in a value?

Answer Posted / pappu kumar sharma

int fnCntbts(int num )
{
int iCnt = 0;
while ( num )
{
num &= (num-1) ;
iCnt++;
}

return iCnt;

}

Is This Answer Correct ?    11 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can a program be made to print the name of a source file where an error occurs?

1267


find the sum of two matrices and WAP for it.

1196


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

1154


How does pointer work in c?

1195


Why is c fast?

1120


What is || operator and how does it function in a program?

1162


Explain how can I pad a string to a known length?

1249


What is a substring in c?

1084


Can we change the value of static variable in c?

1078


Which is an example of a structural homology?

1378


What is a header file?

1138


i have a written test for microland please give me test pattern

2782


List some of the static data structures in C?

1244


What are different storage class specifiers in c?

1138


Can 'this' pointer by used in the constructor?

1133