0 votes
in C Plus Plus by
What is the difference between near, far and huge pointers?

1 Answer

0 votes
by

These are some old concepts used in 16 bit Intel architectures in the days of MS DOS, not much useful anymore. 
Near pointer is used to store 16 bit addresses means within current segment on a 16 bit machine. The limitation is that we can only access 64kb of data at a time. 
far pointer is typically 32 bit that can access memory outside current segment. To use this, compiler allocates a segment register to store segment address, then another register to store offset within current segment. 
Like far pointer, huge pointer is also typically 32 bit and can access outside segment. In case of far pointers, a segment is fixed. In far pointer, the segment part cannot be modified, but in Huge it can be 

Near PointerFar Pointer
It’s size is 2 bytesIts size is 4 bytes
They have the address in between 0-65535(i.e in user area)They have the address more than 65535(i.e out of user area)
For Example:
simple pointers, which we normally studied in C and C++
Pointers which are used in devices, running program, i.e to attack on other computers via this far pointers.

Related questions

0 votes
asked Jan 11 in C Plus Plus by GeorgeBell
0 votes
asked Jan 6 in C Plus Plus by GeorgeBell
...