The differences are only relevant On 16-bit intel architectures. On a 16-bit x86 segmented memory architecture, four registers are used to refer to the respective segments:
DS → data segment
CS → code segment
SS → stack segment
ES → extra segment
A logical address on this architecture is composed of the segment and an offset. Now let see the difference between near far and huge pointers.
- The near pointers refer (as an offset) to the current segment. They don’t have a selector they have an implied selector. The near pointers can access 64k off the virtual address space.
- The Far pointers use segment info and an offset to point across segments. They have an explicit selector. However, when you do pointer arithmetic on them the selector isn’t modified.
- The huge pointers have an explicit selector. When you do pointer arithmetic on them though the selector can change.
Note: On modern platform (32-bit and 64-bit architectures) memory models are using segments differently. And these keyword is not part of C standard.