1

How to know that our system follows little endian or big endian ?

Atul
  • 143
  • 10
  • See http://stackoverflow.com/questions/1001307/detecting-endianness-programmatically-in-a-c-program – torak Aug 22 '13 at 06:19
  • Do you want to check it programatically, or do you just want to know if your platforms endianess? If the first, there are many ways of doing it if you just search a little, if the latter then it depends on your processor and not your operating system. – Some programmer dude Aug 22 '13 at 06:19

1 Answers1

2
int n = 1;
// little endian if true else big endian
if(*(char *)&n == 1) {...}