What is a far pointer? |
[Edit] |
Answer
not local. in assembly, there is a certain amount of memory it has to span before being considered "far"
Answer
Definition: A far pointer in segmented architecture computer is a pointer which includes segment number to address the entire 1mb memory which is available under Dos.
example: int main() {
int a; a=10; printf("%d",&a); return 0;
} Explanation:
When this code is saved/compiled the processor allocates a small amount of memory and memor address is given between the memory range 0 to 65,535.Which is part of the 1mb dos memory ie(10,48,780)bytes.If you want to store data/code beyond the memory range and any where in that 1mb memory.You can do that using the far pointers.By declaring a varible as 'far'pointer.The compiler tells the processor to allocate memory for that specific data/code to perform a specific process in that specific address.The address which is exceeds the 65,535 memory range if referred using the 4 digit hexadecimal number,using the two cpu registers namely segment,offset. While referring to memory address greater than 65,535,the 1mb dos memory is divided into segments,Each segment containing 0 to 65,535 locations(64kb) and to refer these segments the segment register is used.The offset regsiter is used to refer the 65,535 locations present in each segment. So using these two registers(segment:offset)we can refer the entire 1mb memory avialable in Dos.And it is done by writing the segment and offset address side by side like this B8000000.The first four hexadecimal digit represents the segment address and the last four hexadecimal address represents the offset address.
Answer
A far pointer uses both the segment and the offset address to point to a location in memory. A near pointer in contrast uses only the offset address and the default segment. The far pointer can point to any location in memory, whereas the near pointer can only point to a nearby local address.
The distinction between near and far is invisible in newer languages such as Visual Basic, C#, and PHP.
Answer
As far as i can explain it's has something to do with memory addreses in msdos mode only. sorry that's all i can tell you. Can't give details.
Answer
Using Far pointer u can access memory anywhere in your computer memory. The far pointer then needs to contain its own segment value and also the offset.It also have special right that allow it to access memory address outside the segment.Great power,but missuse of far pointer is certainly harmful to the system.
First answer by ID1162077129. Last edit by Haseeb. Contributor trust: 87 [recommend contributor]. Question popularity: 91 [recommend question]
|
Research your answer: |



