2 votes 2 votes #include <stdio.h> int main() { float a=5.375; char *p; int i; p = (char*)&a; for(i=0; i<2; i++) printf("%x", (unsigned char)(p[i]^p[3-i])); return 0; } Explain in detail sid1221 asked Nov 2, 2017 sid1221 1.1k views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply dd commented Nov 2, 2017 reply Follow Share This is not in DETAIL, but it should print two values, first one is $XOR$ of 1st and $4$th Byte of $a$ and second one is $XOR$ of $2$nd and $3$rd Byte of $a$. What we need to do is to figure out the float point representation of $a$ for a $4$ byte container. 0 votes 0 votes Sandeep Suri commented Nov 4, 2017 reply Follow Share Can you explain how it is XOR ? 0 votes 0 votes sid1221 commented Nov 4, 2017 reply Follow Share http://www.geeksforgeeks.org/interesting-facts-bitwise-operators-c/ 0 votes 0 votes Sandeep Suri commented Nov 4, 2017 reply Follow Share Thanks for link understood. 1 votes 1 votes Please log in or register to add a comment.
Best answer 7 votes 7 votes Assuming the machine is little endian. Hemant Parihar answered Nov 2, 2017 • selected Nov 2, 2017 by joshi_nitish Hemant Parihar comment Share Follow See all 0 reply Please log in or register to add a comment.