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
what is the height of tree if leaf node is at level 3. please explain
What are pointers? What are different types of pointers?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
What are the different categories of functions in c?
What is array in C
What is indirection? How many levels of pointers can you have?
How can a string be converted to a number?
List the difference between a While & Do While loops?
What is the best way of making my program efficient?
Write a program to print all permutations of a given string.
Explain the properties of union.
What are the features of c languages?
Write a program of advanced Fibonacci series.
what is the difference between 123 and 0123 in c?