Function to find the given number is a power of 2 or not?
Answer Posted / hassan noureddine
int isPowrOf2 (unsigned int number)
{
float x;
if (number <= 0) return (0);
x = log(number) / log(2);
return ( (int) ( ((int)x*log(2))/log(number)));
}
| Is This Answer Correct ? | 4 Yes | 6 No |
Post New Answer View All Answers
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
Can static variables be declared in a header file?
What is queue in c?
What is string in c language?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
Why doesnt this code work?
Explain what is a stream?
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?
Why clrscr is used in c?
What oops means?
What is the difference between union and structure in c?
Why is c called a mid-level programming language?
How can I write a function that takes a format string and a variable number of arguments?
What is nested structure?
How do I use strcmp?