endian.c
changeset 29 7abf6146898e
parent 27 81a574d60c15
child 77 49e0babccb23
equal deleted inserted replaced
28:54addf5893ef 29:7abf6146898e
     7 #include <stdlib.h>
     7 #include <stdlib.h>
     8 
     8 
     9 int endian ()
     9 int endian ()
    10 {
    10 {
    11     unsigned short word = 0x1234;
    11     unsigned short word = 0x1234;
    12 
       
    13     unsigned char *p = (unsigned char *)&word;
    12     unsigned char *p = (unsigned char *)&word;
    14 
    13 
    15     return ((p[0] == 0x34) ? 0 : 1);
    14     return ((p[0] == 0x34) ? 0 : 1);
    16 }
    15 }
    17 
    16