Don't know why I am struggling hard with this but I have an array of bytes like this:
Code:
{
0x28,0x83,0x63,0x20,0x79,
0xE8,0x39,0x1A,0x59,0x04,
0x89,0x10,0x8D,0x2E,0xF1,
0x11,0x6E,0x00,0x10,0x8D,
0x51,0x57,0x29,0x0D
}
start pointer points to 0x79 and end pointer points to 0x1A. I want start to look like this:
Code:
{0x1A, 0x39, 0xE8, 0x79}
. In other words I want the bytes in reverse and have start point to that reverse order.
Code:
void reverse_order(unsigned char *start, unsigned char *end)
{
printf("What does start refer to 0x%x", *start);
printf("What does end refer to 0x%x", *end);
int i = 4;
do {
*start = *end;
++start;
--end;
printf("What is value of start 0x%x\n", *start);
--i;
} while(i > 0);
}
The output of above looks like this:
Code:
What does start refer to 0x79What does end refer to 0x1aWhat is value of start 0xe8
What is value of start 0x39
What is value of start 0x1a
What is value of start 0x59
Not sure why this isn't working.