author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Sat, 13 Dec 2008 17:57:59 +0100 | |
changeset 7 | a1aa30f0f904 |
parent 0 | af501b0c1716 |
child 8 | 96d16dfe787a |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* $Id: endian.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $ |
|
3 |
* $Source: /development/c/demos/endian.c,v $ |
|
4 |
*/ |
|
5 |
||
6 |
#include <stdio.h> |
|
7 |
#include <stdlib.h> |
|
8 |
||
9 |
int endian () |
|
10 |
{ |
|
11 |
unsigned short word = 0x1234; |
|
12 |
unsigned char *p = (unsigned char *)&word; |
|
13 |
||
14 |
return ((p[0] == 0x34) ? 0 : 1); |
|
15 |
} |
|
16 |
||
17 |
int main (int argc, char **argv) |
|
18 |
{ |
|
19 |
printf ("%s Endian System\n", (endian ())? "Big" : "Little"); |
|
20 |
return EXIT_SUCCESS; |
|
21 |
} |