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

What is "Hungarian Notation"?

1046


What is the use of linkage in c language?

1018


Which is the memory area not included in C program? give the reason

1904


Add Two Numbers Without Using the Addition Operator

778


Explain what happens if you free a pointer twice?

1029


Which is better between malloc and calloc?

1133


Explain threaded binary trees?

1115


What does %d do?

1215


What is size of union in c?

988


When should I declare a function?

1069


Write a program to reverse a given number in c language?

1063


Can a variable be both const and volatile?

1084


What does 4d mean in c?

1456


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

1111


What is the purpose of void in c?

1003