javascript
Brief description  about Online courses   join in Online courses
View ashok kumar 's Profile

Who to know whether system uses big endian or little endian format and how to convert among them?

Who to know whether system uses big endian or little endian format and how to convert among them?
Asked by ashok kumar | Aug 5, 2010 |  Reply now
Replies (1)
View embedded instructor 's Profile
Here is a small code segment to determine the endianess of a system at run time.

short int number = 0x1;
char *byte = (char*)&number;
if ( byte[0] )
printf("Little endian");
else
printf("Big endian");
Aug 5, 2010