#include <stdio.h> int IsBigEndian() { union NUM { int a; char b; }num; num.a = 0x1234; if( num.b == 0x12 ) { return 1; } return 0; } void main(void) { int i; i = IsBigEndian(); printf("%d",i); system("pause"); }