Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How can I convert a number to a string?

1184


Why c is a procedural language?

1054


Explain what is operator promotion?

1086


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1348


difference between object file and executable file

6723


What is actual argument?

1062


What is a method in c?

1144


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

1032


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

1049


Difference between linking and loading?

1105


Can you please explain the scope of static variables?

1057


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

2180


What is #ifdef ? What is its application?

1112


What is a pointer variable in c language?

1103


How many levels of indirection in pointers can you have in a single declaration?

1088