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
How to compare array with pointer in c?
explain what is fifo?
What is %s and %d in c?
What is the best organizational structure?
the question is that what you have been doing all these periods (one year gap)
What are loops c?
How to establish connection with oracle database software from c language?
Is a house a mass structure?
how to find anagram without using string functions using only loops in c programming
What is pragma in c?
What is the general form of a C program?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
What is a stream water?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
What does c mean in basketball?