This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Difference in representation of union

Hello,
in some *.c file I write:

union U
{
unsigned char c[2];
unsigned int i;
}u;

void fun(void)
{
u.c[0] = 0x12;
u.c[1] = 0x34;
}

In C51 u.i = 0x1234 but in C166 u.i = 0x3412.
I think that in C166 correctly. Whence such difference in a data representation?
Thanks.

0