The article is written in ISO C90
 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
/*
 * A far pointer is a pointer that includes a segment selector, making it possible
 * to point to addresses outside of the default segment.
 * In 16-bit code, a far pointer has two parts: a 16-bit segment value and a 16-bit
 * offset value. A linear address is obtained by shifting the binary segment value
 * four times to the left, and then adding the offset value.
 * There can be up to 4096 different segment-offset address pairs pointing to one
 * physical address.
 * On C compilers targeting the 8086 processor family, far pointers were declared
 * using a non-standard `far` qualifier.
 *
 * The given example prints 81 because both addresses point to same location.
 * Physical Address = (value of segment register) * 0x10 + (value of offset).
 * Location pointed to by pointer 'p' is : 0x5555 * 0x10 + 0x0005 = 0x55555
 * Location pointed to by pointer 'q' is : 0x5333 * 0x10 + 0x2225 = 0x55555
 */

#include <stdio.h>

int main(){
	char far *p = (char far *)0x55550005;
	char far *q = (char far *)0x53332225;
	*p = 80;
	(*p)++;
	printf("%d",*q);
	return 0;
}