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
Difference between Shallow copy and Deep copy?
Explain what is operator promotion?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
What is the difference between a string and an array?
Is python a c language?
What is "Hungarian Notation"?
What does %c do in c?
How can you find the day of the week given the date?
What are the types of functions in c?
What is a struct c#?
What is a void pointer? When is a void pointer used?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
can any one tel me wt is the question pattern for NIC exam
Explain the difference between the local variable and global variable in c?