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
What does %p mean?
Can one function call another?
Is a pointer a kind of array?
What is derived datatype in c?
What is this infamous null pointer, anyway?
What is #pragma statements?
a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode
Which header file should you include if you are to develop a function which can accept variable number of arguments?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
writ a program to compare using strcmp VIVA and viva with its output.
What is a structure and why it is used?
State the difference between x3 and x[3].
What is a static variable in c?
what do you mean by enumeration constant?