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
pierrot's divisor program using c or c++ code
What is int main () in c?
Can a variable be both static and volatile in c?
Explain what is output redirection?
What does printf does?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
Explain what is the difference between functions getch() and getche()?
How can I automatically locate a programs configuration files in the same directory as the executable?
What does %p mean c?
If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.
Explain zero based addressing.
What are the basic data types associated with c?
Why we not create function inside function.
How many bytes is a struct in c?