Function to find the given number is a power of 2 or not?
Answer Posted / abhishek sharma
unsigned int is_power_of_2(unsigned int x)
{
return (x != 0) && ((x & (x - 1)) == 0);
}
Is This Answer Correct ? | 23 Yes | 3 No |
Post New Answer View All Answers
Explain how do you search data in a data file using random access method?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What is the difference between abs() and fabs() functions?
Explain how can I make sure that my program is the only one accessing a file?
What is %lu in c?
Is array name a pointer?
What are the types of i/o functions?
When a c file is executed there are many files that are automatically opened what are they files?
write a program to find out prime number using sieve case?
What is a c token and types of c tokens?
What are pointers in C? Give an example where to illustrate their significance.
What is const and volatile in c?
Explain the use of bit fieild.
Is c procedural or functional?
What are categories used for in c?