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 can a program be made to print the name of a source file where an error occurs?
find the sum of two matrices and WAP for it.
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
How does pointer work in c?
Why is c fast?
What is || operator and how does it function in a program?
Explain how can I pad a string to a known length?
What is a substring in c?
Can we change the value of static variable in c?
Which is an example of a structural homology?
What is a header file?
i have a written test for microland please give me test pattern
List some of the static data structures in C?
What are different storage class specifiers in c?
Can 'this' pointer by used in the constructor?