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

Explain how do you determine whether to use a stream function or a low-level function?

618


Does sprintf put null character?

595


Explain how to reverse singly link list.

603


What is the need of structure in c?

562


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

1623






What are data structures in c and how to use them?

669


What is malloc return c?

596


What are multidimensional arrays?

653


Explain what are the standard predefined macros?

647


What does sizeof function do?

608


What are the loops in c?

589


explain what are pointers?

615


What is const volatile variable in c?

572


In a switch statement, what will happen if a break statement is omitted?

598


Why is c used in embedded systems?

606