Alright, I've cooked up some code to reverse hex characters around as part of a fun exercise I made up.
Here is what I have at the moment:
#include <stdio.h>
int main() {
char a,b,c;
while (1) {
c = getchar();
if (!feof(stdin)) {
a = c % 16;
b = (c - a) / 16;
c = (a*16) + b;
putchar(c);
}else{break;}
}
return 0;
}
It works well for most values. For example, 0xA0 becomes 0x0A etc...
However, it's not playing well with values beginning with 'F'.
0xF1 becomes 0x10
0xFF becomes 0xF0
etc...
Can somebody point me into the right direction?