Hi, I have what is probably a really elementary question but I can't seem to figure it out. In the following snippet of code, why is it that a and b do not have the same value in the end ? :
#define uint32_t unsigned int #define uint16_t unsigned short #define uint8_t unsigned char #define uint64_t unsigned long long int main () { uint32_t a = 0x01020304; /* This prints 01020304 */ printf ("a = %0X \n",a); uint32_t * b; uint8_t bytes [] = {0x01,0x02,0x03,0x04}; b = (uint32_t *) bytes; /* This prints 04030201 */ printf ("b= %0X \n", *b); return 1; } Im asking this as I am currently encoding a protocol in which i receive data as a sequence of bytes. Casting for example 4 bytes from this stream leaves me with the situation in variable b, while the situation I am looking to accomplish is the one in A (i.e. the bytes are not encoded in reverse form). Thanks in advance for your help. Regards, Daniel _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"