// C program to find if machine is little endian or big endian
#include <stdio.h>
int main()
{
unsigned int n = 1;
char *c = (char*)&n;
if (*c)
{
printf("Little endian..");
}
else
{
printf("Big endian..");
}
return 0;
}
int main()
{
unsigned int n = 1;
char *c = (char*)&n;
if (*c)
{
printf("Little endian..");
}
else
{
printf("Big endian..");
}
return 0;
}
OUTPUT:
Little endian..
Little endian..