Question: Write code to implement the following function: /* Return 1 when any odd bit of x equals 1; 0 otherwise. Assume w=32. */ int any_odd_one(unsigned
This is C code. I just want to understand this code clearly. Specifically when copmaring the bits with the and opperator.
#include
int any_odd_one(unsigned x)
{
return (x & 0x55555555) && 1; <------------------------ Can you explain what is going on here?
}
int main()
{
unsigned j;
printf("Enter integer ");
scanf("%u",&j);
printf("%d",any_odd_one(j));
}
Step by Step Solution
3.49 Rating (172 Votes )
There are 3 Steps involved in it
find... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
635f619f3cb30_231895.pdf
180 KBs PDF File
635f619f3cb30_231895.docx
120 KBs Word File
