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 / boomer

pseudo

int size is 32 bits...right?

for(i = 0 to 31)
{
count += (value & 1) //& = and oprator
shift left value
}

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are header files in c?

1085


Explain that why C is procedural?

1150


What is s in c?

1056


Why dont c comments nest?

1054


how to write a c program to print list of fruits in alpabetical order?

2306


How do you view the path?

1137


Explain modulus operator. What are the restrictions of a modulus operator?

1022


What is the difference between functions getch() and getche()?

1099


Place the #include statement must be written in the program?

1046


What is type qualifiers?

1140


Why is c not oop?

982


Why does the call char scanf work?

1213


How can I manipulate strings of multibyte characters?

1115


List some of the static data structures in C?

1204


What are called c variables?

1071