answersLogoWhite

0


Best Answer

If you're a beginner you don't need to worry about near and far pointers. They are a concept that have been obsoleted on most PCs. If you are programming for an embedded device, read the datasheet. It will explain it in terms of the device you are programming for.

User Avatar

Wiki User

18y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you explain what near far and huge pointers are to a beginner?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why Near pointers are used for all code and data references in huge memory model for turbo C?

You may have misunderstood something. Choose Huge Model,and forget about near and far. (Honestly, this topic is outdated by twenty years!)


How to declare near and far pointers in C?

It used to be a good question 30 years ago. Right know you don't have to know anything about near and far pointers; but if you still use a 16-bit compiler, select 'Large Model' (or 'Huge Model'), and forget 'near' and 'far'


What is Normalization of pointers?

The 8085 had a 16-bit address bus thus it could address a maximum of 64KB of memory (2^16). The 8086 had a 20-bit address bus and could therefore address a maximum of 1MB of memory (2^20). To maintain compatibility, segmented memory was introduced, such that the segment and offset were stored in separate 16-bit registers. In order to perform 20-bit pointer arithmetic upon the 8086, the segment and offset had to be normalised by the compiler to produce a valid 20-bit address. This was achieved by left-shifting the segment by 4 bits and then adding on the offset. The 8086 also introduced the concept of near, far and huge pointers. A near pointer only stores the offset while far and huge pointers store both the segment and the offset. The only practical difference between far and huge pointers is in how pointer arithmetic works. With far pointers, only the offset is affected whereas with huge pointers, both the segment and the offset are affected.


Why are header files not required when using far and near pointers?

In C programming, header files are required. It doesn't matter if you are using near pointers, far pointers, both, or neither -- you still need header files. There is no connection between the necessity of header files and the pointers' size.


What is near far and huge pointers How many bytes are occupied by them?

Near, far, and huge pointers are different types of pointers used to reconcile the different addressing models of the Intel 8086/8088 class processors, running in a 16-bit operating system such as Windows 3.x, as well as any of the newer incarnations running in real mode or virtual 8086 mode.A near pointer can address something within one 64Kb memory segment, containing only an offset, and it takes two bytes. The segment is implied by context, and is usually the data segment, selected for the addressing model.A far pointer can address anything in the 1Mb memory1, containing both a segment and an offset, and it takes four bytes.A huge pointer is a normalised far pointer, which means its offset part is always between 00H and 0FH.In 32-bit mode a pointer can address anything in 4Gb memory, containing a flat 32-bit offset, and it takes four bytes. (In this mode segments have no significance.) It only works, however, when there is support for it, such as the WIN32 extension of Windows 3.x.---------------------------------------------------------------------------------------1In the 80286 or higher, running in protected mode, in OS/2, the segment portion of the pointer is actually a descriptor selector, so 1Mb addressibility depends on the operating system environment.far huge near pointer is an oxymoron. far points to memory outside of the normal address space. near points to memory within the normal address space, is the default, and usually is not needed. I've never seen huge before. What is the target architecture?Near, far, and huge pointers are a construct (usually) in the Win16 environment running on an 8086/8088 or later in real mode, such as Visual C/C++ 1.52. In this environment, near pointers are 16 bits, and far and huge pointers are 32 bits.


What are near pointers in c?

Just forget it, it was a question twenty years ago when we worked in MS-DOS with a 16/20 bit CPU. Near pointers contain 16 bits, far pointers contain 32 bits (but only 1MB (or 1MB+65520 bytes) are really addressible).


What are huge and dangling pointers in C language?

A huge pointer was a special type of pointer used in the WIN161 environment that would allow you to monolithically handle objects of size greater than 64KB as if that were one single address space. If you had the special WIN32 add-on installed, you could declare and use huge pointers natively, but normally, you had to do address translation to go from huge to far and from far to huge.A dangling pointer is not something I have heard of. The closest I can interpret this is a misunderstanding of dangling if statements, although it could be a reference to leaking memory through unallocated pointers that go out of scope before they are freed. Please restate the question, with better details.1 Today, with true 32 and 64 bit operating systems abounding, the concept of near, far, and huge pointers is obsolete and archaic. The need to deal with them disappeared with Visual Studio 1.52 and Windows 3.1. (Of which I still have working copies. :-)>)


When should a far pointer be used?

Never. 'near' and 'far' pointers are outdated by twenty years!


Can char pointer contain long address in c?

What do you mean by 'long address'?1. If you are asking about 'near' and 'far' pointers, then you should forget them; simply use Huge Memory Model.2. If you mean the address of a 'long int'-type variable, then yes, with type-cast:long l;char *p = (char *)&l;Note: for generic pointers you can use type void *


Does Miley Cyrus live near a beach?

Miley Cyrus lives near a beachand she has a huge house with a huge pool


What settings do you need to use far keywords and other c style syntax in our programs while writing programs in VC?

There are no settings. Near and far pointers are specific to segmented memory models but when working with virtual memory models we always use normalised pointers which are always the same length (in bits). Near pointers use fewer bits than normalised pointers (usually half as many bits) because they only refer to the offset address within the current segment. Far pointers are similar to normalised pointers, except the high-order word refers to the segment address and the low-order word refers to the offset within that segment.


What is near pointer?

In the segmented memory model, a near pointer is a memory address that resides in the same segment as the current segment pointer. It had half the memory requirements of a far pointer (which stored the segment and offset, instead of just the offset), but was limited to 1/65536th the maximum distance of the memory that could be referenced. Since the introduction of the flat memory model, all pointers are near pointers, because segments are no longer used in the segmented model addressing. Instead, segments are used for task gates (protected memory), so no normal program would ever access a segment directly. A developer would only need to worry about "near" and "far" pointers on 386s and older processors. It should be noted that other system architectures, such as PowerPC, RISC, and so on, all do not have the concept of segmented memory, and so do not have near or far pointers at all. Instead, all pointers are of the same size and can address any memory location.