home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
sml_nj
/
93src.lha
/
src
/
runtime
/
endian.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1993-02-09
|
305 b
|
21 lines
/* endian.c
*
* COPYRIGHT (c) 1990 AT&T Bell Laboratories.
*
* Determine the endianess of this machine.
*/
char s[4] = {0x01, 0x02, 0x04, 0x08};
main ()
{
int *p = (int *)s;
if (*p == 0x01020408)
printf("Big\n");
else if (*p == 0x08040201)
printf("Little\n");
else
exit(1);
}