Give a method to count the number of ones in a 32 bit number?
Answer Posted / ataraxic
int i = 0;
while (x) {
x &= x-1;
++i;
};
printf("number of ones is %d\n", i);
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Where register variables are stored in c?
What is double pointer?
How do you determine whether to use a stream function or a low-level function?
What is the correct code to have following output in c using nested for loop?
The statement, int(*x[]) () what does in indicate?
Describe how arrays can be passed to a user defined function
Why can’t we compare structures?
Who invented bcpl language?
What is function prototype in c language?
What are type modifiers in c?
How pointer is different from array?
write a program to generate address labels using structures?
What is void main () in c?
What functions are in conio h?
What are types of preprocessor in c?