write a program to find out number of on bits in a number?
Answer Posted / minisha
int count(unsigned int n)
{
int c=0;
while(n)
{
n=n&(n-1);
c++
}
return c;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
When should structures be passed by values or by references?
Can a void pointer point to a function?
What is the explanation for modular programming?
What's the right way to use errno?
What does main () mean in c?
How can I send mail from within a c program?
What is a static variable in c?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Explain indirection?
hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel
What is use of #include in c?
What is difference between arrays and pointers?
How do I convert a string to all upper or lower case?
How do you write a program which produces its own source code as output?