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
How can I convert a number to a string?
Why c is a procedural language?
Explain what is operator promotion?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
difference between object file and executable file
What is actual argument?
What is a method in c?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
Difference between linking and loading?
Can you please explain the scope of static variables?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What is #ifdef ? What is its application?
What is a pointer variable in c language?
How many levels of indirection in pointers can you have in a single declaration?