1

Possible Duplicate:
Determining endianness

How to know the Endianness of my linux any command or any other method. I tried like this:

#include <stdio.h>
void main (void)
{
 char *ch;
 int i = 1031;
 ch = (char *) &i;
 printf("%u: %d\n%u: %d\n",(unsigned) ch, *ch,(unsigned)(ch+1), *(ch+1));
}

and i got the below output:

3212920104: 7

3212920105: 4

Here lowest byte is stored at lowest address & highest @ highest address. So can i consider my machine as Little endian?

Community
  • 1
  • 1
srikanthM
  • 283
  • 1
  • 4
  • 10

0 Answers0