本帖最后由 ChanTaiMan 于 2009-12-7 14:06 编辑
I am having a group of characters to change to long
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07;
And I am expecting the result is:-
0x03020100, 0x04030201, 0x05040302, 0x06050403, 0x07060504.
And here is my program:-
unsigned char MyChar[8] =
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
unsigned long *pLong;
pLong =(unsigned long *) &Mychar[0];
printf(“My Long; %08X”, *pLong);
And I got:
0x00000000
pLong = (unsigned long *)&Mychar[1];
printf(“My Long; %08X”, *pLong);
0x00000001
So on....
I am using Keil C for ARM 3.0
Any suggestion?
Jacky |