summaryrefslogtreecommitdiff
path: root/support/lgrind/example/egcprog.c
blob: b79f44805103e58cfcfbcc6607c5b8e6c0cdbb48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* endian.c
 * Demonstrates endian ordering
 */

#include <stdio.h>

void main( void )
{
	short   Data_16; 
	long    Data_32;
	char far *p;

	Data_16 = 0x1234;
	Data_32 = 0x56789abc;

	p = (char far *)&Data_16;
	printf("16-bit quantity, data=%04x\n", Data_16);
	printf("address %Fp = %02x\n", p, (int)(*p) & 0xff);
	p++ ;
	printf("address %Fp = %02x\n", p, (int)(*p) & 0xff);
	p++ ;


	p = (char far *)&Data_32;
	printf("32-bit quantity, data=%08lx\n", Data_32);
	printf("address %Fp = %02x\n", p, (int)(*p) & 0xff);
	p++ ;
	printf("address %Fp = %02x\n", p, (int)(*p) & 0xff);
	p++ ;
	printf("address %Fp = %02x\n", p, (int)(*p) & 0xff);
	p++ ;
	printf("address %Fp = %02x\n", p, (int)(*p) & 0xff);

}