I had to create a function that can be given an int with up to 32 bits. It is supposed to return 1 if an odd bit is 1 and 0 otherwise. I understand that if it does not match the mask it returns zero, but I don't understand why it returns one if it matches the mask. Is it because after the & comparison the result does not equal 0 and therefore returns true which is one?
int any_odd_one(unsigned x)
{
return (x&0xAAAAAAAA)!=0;