How to check if your machine is Little Endian or Big Endian using C program in Linux

 $ vim check_endian.c 
#include <stdio.h>
int main(int argc, char **argv) { int num = 1; if(*(char *)&num == 1) { printf("\nLittle-Endian\n"); } else { printf("Big-Endian\n"); }
}
 $ gcc -o check_endian check_endian.c 
 $ ./check_endian 
READ  Remove all mistyped emails, unsubscribed emails or bounced emails from Email List

Leave a Reply

Your email address will not be published. Required fields are marked *