I have got this question: Write function of f(x) that return the number of bits set to 1 in an unsigned integer.
So the outcome of the result will be sometime like f(5) = 2 cos [5 in binary is 101 and it got 2 '1s')
Here's my program:
int bitcount(unsigned x);
for (b=0; x!=0; x >>=1)
if (x &01)
And the error is "return b" >> parse error before `return'
how should i ammend this? Please advise. Thanks.