changeset 0 | af501b0c1716 |
child 8 | 96d16dfe787a |
-1:000000000000 | 0:af501b0c1716 |
---|---|
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 } |