write a program to find out number of on bits in a number?
Answer Posted / jaya j
unsigned int count1s(unsigned char x)
{
int p;
for(p=0;x!=0;x>>=1)
if(x&1)
p++;
return p;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Can you please compare array with pointer?
Why is C language being considered a middle level language?
Why is c platform dependent?
What is f'n in math?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
Explain how do you use a pointer to a function?
Give me the code of in-order recursive and non-recursive.
Apart from dennis ritchie who the other person who contributed in design of c language.
Which is more efficient, a switch statement or an if else chain?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
What is the use of bit field?
How do c compilers work?
What is the auto keyword good for?
What is an example of structure?
Differentiate between a structure and a union.