Hello!
The book Programming in C/C++ "The Bible" is, in my opinion, an excellent book but, because it is an "old book (1999, as well as the book C Complete and Total)", it uses many resources that are outdated, whether it’s because of modifications to hardware technologies or upgrades to the C/C++ programming language, I recommend reading it after you have an initial knowledge of the language, as well, whenever you find something strange and/or a command that doesn’t work properly, do a search on the net or pass stackoverflow, plus the book contains a very good didactic and was once considered one of the best on the subject.
Below is an explanation taken from the net:
In the past, x86 processors supported only one mode of operation, called real mode. In real mode the memory was divided into segments, with fixed size of 64kb. Programming was a big challenge. The address bus was capable of carrying only 20 bits at a time, so there was a memory addressing limit of 1MB (2 20). This 1MB memory was divided into 16 segments of 64 Kb each. A segment was divided into displacements (Offset).
The memory was addressed in two parts: Segment:Offset. So, to access a certain region, we first put the address of the Segment and then a position within the segment, which is the Offset.
Ex: 0007:7B90
Well, I explained a lot, but so far I didn’t say anything about the NEAR and FAR pointers... but this explanation was necessary before :).
A NEAR pointer occupied 2 bytes and could access positions only within a segment (64kb). In fact, a NEAR pointer stored the Offset.
A FAR pointer occupied 4 bytes and was used to access an Offset in any segment. 2 bytes were used to address the segment and the other 2 bytes were used for offset.
HUGE pointers are very similar to FAR pointers, but have some advantages. In logical comparisons, for example, segment and offset are compared, while only offsets are compared in the case of FAR pointers. The downside is that addressing with a HUGE pointer is a little slower.
The use of each pointer depended on the memory model used (SMALL, TINY, LARGE, MEDIUM, etc.). The memory model specified how the code segment and data segment were structured.
The declaration of these pointers (NEAR, FAR and HUGE) are not part of the ANSI C standard and are not portable (they depend on the x86 platform).
Segmented memory is a thing of the past; running in protected mode, we now have all the available memory, in a model known as flat-memory. The distinction between NEAR, FAR and HUGE pointers is no longer required. Since the memory is no longer segmented, a pointer (which in this case is a NEAR) is sufficient to access any position (in rare cases a FAR pointer is still required... to access the buffer frame for example). Today, CS, DS, SS point to the same 'segment'.
I hope I helped, I am also an apprentice of C/C++/C#, I have this book since the year 2000 and I like it very much.
Hugs and good luck on the journey!
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.
– Maniero