endian.c
changeset 27 81a574d60c15
parent 9 c3fecc82ade6
child 29 7abf6146898e
equal deleted inserted replaced
26:d227047a3e88 27:81a574d60c15
     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 
    12     unsigned char *p = (unsigned char *)&word;
    13     unsigned char *p = (unsigned char *)&word;
    13 
    14 
    14     return ((p[0] == 0x34) ? 0 : 1);
    15     return ((p[0] == 0x34) ? 0 : 1);
    15 }
    16 }
    16 
    17