#include <stdio.h>
#include <stdlib.h>
//X86 and MCU is little endian.
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int checkType()
{
unsigned int value = 0x1122;
unsigned short int temp = (unsigned short int)value;
return temp==0x22?1:0;
}
int main(int argc, char *argv[])
{
if(checkType())
printf("this computer is big endian\n");
else
printf("this computer is little endian\n");
return 0;
}