I have been arguing with someone that you can check if a machine is big or little endian with this code:
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
#include <stdio.h>
#include <stdbool.h>
const bool __LITTLE_ENDIAN__ = ( 0x00FF > 0x0100 );
int main(void){
	printf("%d",__LITTLE_ENDIAN__);
}
Any answers are appreciated,
Danny
Little Endian testing in C
1 
Offline
How could they convert it into the machines endianness?? Evil. Pure evil.
DannyDeth