dev/c/endian/testendian.c

9 lines
167 B
C
Raw Normal View History

2012-03-12 19:38:23 +04:00
#include <stdio.h>
unsigned short x = 1; /* 0x0001 */
int main(void)
{
printf("%s\n", *((unsigned char *) &x) == 0 ? "big-endian" : "little-endian");
return 0;
}