answersLogoWhite

0

int bitcount (unsigned n)

{

int bitc= 0;

while (n) {

++bitc;

n = n&(n-1);

}

return bitc;

}

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan

Add your answer:

Earn +20 pts
Q: Write a c plus plus program that counts the no. of 1 bit in a given integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp