Dos is designed to be based on 16-bit CPUs, that is, each register (register) in the CPU is only 16 bits, only the value of 0-65535 (64K) can be stored. In order to access more than 64K of memory, people used a segmented method, with two 16-bit number to record the logical address, the first is the segment value (Segment), the second is the offset (offset), the written format is generally the segment value: Offset. such as 0100:0020 (16 binary, the address is usually in hexadecimal digits). This will have a 32-bit address. Strictly speaking, because of the hardware, the segment value of bits (hexadecimal digits of course) can only be zero, and this segmented method does not access all addresses in the 32-bit range.
The General DOS program puts the executed code in one segment, and the data in the other segment. Of course, this is only logical. And there are exceptions, such as all the COM format of the program code snippet also put data.
The executable (EXE) generated by the 16-bit C compiler (such as TC 2.0, m$ C) under Dos can be selected in code mode, for example: Huge, Large, Medium, Small, Tiny (Compact) and so on. The difference is only the number of segments to put code and data.
If you understand the above, the following is a good understanding.
The integer and pointer of the 16-bit C compiler are 16 bits by default. The default pointer has only a value of offset (offset) and can only point to the same segment. Also called proximity pointer (near Pointer). When you want to use a pointer to access another segment, you define a remote pointer (far Pointer) with a pointer of 32 bits. A pointer must be defined as a remote pointer (far Pointer) when the program has more than one code snippet (if it is a function pointer) or data segment (if it is a variable pointer) and the pointer is not in the same segment as the point where it is pointing.
Their own posts back, this is the previous akuma of the explanation of the far pointer, understand!
Far and near two pointers in C/A + +