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
What is a volatile keyword in c?
What is variable and explain rules to declare variable in c?
Can you assign a different address to an array tag?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
How do you define a function?
Disadvantages of C language.
Which control loop is recommended if you have to execute set of statements for fixed number of times?
How can a program be made to print the line number where an error occurs?
When c language was developed?
What is the use of typedef in c?
What is array of structure in c?
What type is sizeof?
What is sizeof in c?
Who is the founder of c language?
Why is c called "mother" language?