Hello !
Now, I am able to get reverse byte order using the following function:
parameter n is the given number (user input). Now, the task it to come up with the same output but using union. Anyone who has an idea?Code:void GetReverseHexa(int n) {
int a, b, c, d, e;
a = n & 0x000000FF;
b = n & 0x0000FF00;
c = n & 0x00FF0000;
d = n & 0xFF000000;
a <<= 24;
b <<= 8;
c >>= 8;
d >>=24;
e = a|b|c|d;
printf("\nReverse byte order: %2x\n\n",e);
}
