Wednesday, November 11, 2009

DataStructures: To find whether the system follows little endianor big endian

int main ()
{
long val = 1;
char *c = (char *) &val;
if( *c == 1 ) printf( "Little endian");
else printf("Big endian");

return 0;
}

No comments: