Function to find the given number is a power of 2 or not?

Answer Posted / ms

int ispow2(int number)
{
if(n<o) {
return 0;
}

else {

return !(number&(number-1));

}

Is This Answer Correct ?    76 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use static in c?

627


Define Array of pointers.

627


Who developed c language?

630


I came across some code that puts a (void) cast before each call to printf. Why?

671


Explain how can type-insensitive macros be created?

564






What is structure of c program?

597


Explain the difference between ++u and u++?

633


What does the error 'Null Pointer Assignment' mean and what causes this error?

732


how to create duplicate link list using C???

2065


What is pointer to pointer in c?

626


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

797


Give differences between - new and malloc() , delete and free() ?

601


What are the 4 types of unions?

601


Why do we use c for the speed of light?

601


Can math operations be performed on a void pointer?

581