what is a far pointer

Answers were Sorted based on User's Feedback



what is a far pointer..

Answer / sujith

I am not very sure what Bhardwaj is trying to answer with a
secondary memory. If he point out something to your hard
disk or something like that, i think i cannot agree with that.

Any pointer by default is a near pointer. another set of
pointers are far and huge, and they differ only in terms how
they store the value of the normalised pointer value.

A far/huge pointer is used to access a location which is
outside your current segment.

Is This Answer Correct ?    53 Yes 10 No

what is a far pointer..

Answer / imran hassan bergi

Near pointers have a size of 2 bytes. They only store the
offset of the address the pointer is referencing. An
address consisting of only an offset has a range of 0 - 64K
bytes starting from the beginning of DGROUP. A near pointer
can be incremented and decremented using arithmetic
operators (+, -, ++, and --) through the entire address
range. Any attempt to increment a near pointer that has a
value of 64K (0xffff) will result in a value of 0. This is
referred to as wrapping the pointer. A corresponding result
can be expected when attempting to decrement a pointer that
contains an address of 0, except the result will be 64K
instead of 0. In addition to being incremented and
decremented, near pointers can be compared to one another
using relational operators ( <, >, ==, >= and <= ). Far
pointers have a size of 4 bytes. They store both the
segment and the offset of the address the pointer is
referencing. A far pointer has an address range of 0 - 1M
bytes. It is important to understand that an addressing
range of 1M does not remove the 640K barrier from the
program. It means that the pointer can address the upper
memory area (641 - 1M) which typically contains video
memory, ROM and anything else that may be loaded high. A
far pointer can be incremented and decremented using
arithmetic operators. When a far pointer is incremented or
decremented ONLY the offset of the pointer is actually
incremented or decremented. The segment is never
incremented by the arithmetic operators. This means that
although a far pointer can address up to 1Mb of memory, it
can only be incremented through 64Kb and the offset will
start at zero again without changing the value of the
segment. This is referred to as "wrapping" the pointer
(e.g. 0F3E:FFFF + 1 = 0F3E:0000). When a far pointer is
decremented from zero it will wrap the other way and become
64K. Far pointers are not unique. It is possible to have
two far memory addresses that have different segments
values and different offset values that address the same
memory location e.g. 0777:2222 has an absolute address of
07770 + 2222 = 09992 and 0999:0002 has an absolute address
of 09990 + 0002 = 09992. When relational operators are used
on far pointers only the offsets are compared. For example:
if we let a = 0777:2222 and let b = 0999:0002 then a == b
would return false because this is equivalent to 2222 ==
0002 which is in fact false. In other words relational
operators will only work on far pointers if the segment
values of the pointers being compared are the same. Huge
pointers have a size of 4 bytes. They store both the
segment and the offset of the address the pointer is
referencing. A huge pointer has an address range of 0 - 1M
bytes. A huge pointer can be incremented and decremented
using arithmetic operators. The only difference between a
far pointer and a huge pointer is that a huge pointer is
normalized by the compiler. A normalized pointer is one
that has as much of the address as possible in the segment,
meaning that the offset is never larger than 15. A huge
pointer is normalized only when pointer arithmetic is
performed on it. It is not normalized when an assignment is
made. You can cause it to be normalized without changing
the value by incrementing and then decrementing it. The
offset must be less than 16 because the segment can
represent any value greater than or equal to 16 (e.g.
Absolute address 0x17 in a normalized form would be
0001:0001. While a far pointer could address the absolute
address 0x17 with 0000:0017, this is not a valid huge
(normalized) pointer because the offset is greater than
0000F.). Huge pointers can also be incremented and
decremented using arithmetic operators, but since they are
normalized they will not wrap like far pointers. Huge
pointers can be reliably used with relational operators
because they are normalized. This works because
normalization of huge pointers insures that every huge
pointer is unique. It is important to understand that huge
pointers are never the default pointer, even in the huge
memory model.

Is This Answer Correct ?    27 Yes 5 No

what is a far pointer..

Answer / sanjiv sharma

a far pointer is a pointer which includes a segment
selector, making it possible to point to addresses outside
of the current segment.

Is This Answer Correct ?    22 Yes 3 No

what is a far pointer..

Answer / gopal

Far Pointer: A far pointer is that which will point anywhere
in the X MB across segments by containing segment+offset .
far pointers are the normalized pointers of four bytes which
are used to access the main memory of the computer ?it can
access both the data segment and code segment thus by
modifying the offset u can modify refer two different
addresses but refer to the same memory .
Far pointers are not Normalized.

Is This Answer Correct ?    17 Yes 2 No

what is a far pointer..

Answer / jagdeep

Far pointer is 4 byte poinetr and near pointer is 2 byte
pointer.Far pointer is used to point any specified memory
location but near pointer is used to specify only main
memory location.

Is This Answer Correct ?    10 Yes 1 No

what is a far pointer..

Answer / rachna

far pointer is a pointer that include segment
selector.which is used to select a segment that is outside
the current segment.

Is This Answer Correct ?    11 Yes 4 No

what is a far pointer..

Answer / sankar

in OS the memory is divided into segments.
so by using near pointer we can point with in the same segment.
where as by using far pointer we can point any segment in
the memory.

Is This Answer Correct ?    7 Yes 4 No

what is a far pointer..

Answer / praveen kondapaturi

A far/huge pointer is used to access a location which is
outside your current segment.

It includes a segment selector, making it possible to point
to addresses outside of the current segment.

Is This Answer Correct ?    0 Yes 0 No

what is a far pointer..

Answer / mrs.ahmer

A far pointer is a pointer which includes segment number.
In a segmented architecture computer, far pointers are used
to address the entire 1mb memory which is available under
Dos.

Is This Answer Correct ?    0 Yes 1 No

what is a far pointer..

Answer / lalit kumar

Far pointers have a size of 4 bytes. They store both the
segment and the offset of the address the pointer is
referencing. A far pointer has an address range of 0 - 1M
bytes. It is important to understand that an addressing
range of 1M does not remove the 640K barrier from the
program. It means that the pointer can address the upper
memory area (641 - 1M) which typically contains video
memory, ROM and anything else that may be loaded high.
1: A far pointer can be incremented and decremented using
arithmetic operators. When a far pointer is incremented or
decremented ONLY the offset of the pointer is actually
incremented or decremented. The segment is never incremented
by the arithmetic operators. This means that although a far
pointer can address up to 1Mb of memory, it can only be
incremented through 64Kb and the offset will start at zero
again without changing the value of the segment. This is
referred to as "wrapping" the pointer
(e.g. 0F3E:FFFF + 1 = 0F3E:0000).
2:When a far pointer is decremented from zero it will wrap
the other way and become 64K.
3:Far pointers are not unique. It is possible to have two
far memory addresses that have different segments values and
different offset values that address the same memory
location e.g. 0777:2222 has an absolute address of
07770 + 2222 = 09992 and 0999:0002 has an absolute address
of 09990 + 0002 = 09992. When relational operators are used
on far pointers only the offsets are compared. For example:
if we let a = 0777:2222 and let b = 0999:0002 then a == b
would return false because this is equivalent to 2222 ==
0002 which is in fact false. In other words relational
operators will only work on far pointers if the segment
values of the pointers being compared are the same.

Is This Answer Correct ?    3 Yes 5 No

Post New Answer

More C Interview Questions

How do you initialize pointer variables?

0 Answers  


Explain modulus operator. What are the restrictions of a modulus operator?

0 Answers  


why u join this call center?

6 Answers   DELL,


Define function ?Explain about arguments?

2 Answers   Geometric Software, Infosys,


what is inline function?

2 Answers  






21. #define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

3 Answers  


main() {int a=200*200/100; printf("%d",a); }

14 Answers   TCS,


What is difference between array and structure in c?

0 Answers  


program in c to print 1 to 100 without using loop

9 Answers   Wipro,


Which of the Following will define a type NODE that is a node in a Linked list? A)struct node {NODE*next;int x;};type def struct node NODE; B)typedef struct NODE {struct NODE *next;int x;}; C)typedef struct NODE {NODE *next;int x;}; D)typedef struct {NODE *next;int x;}NODE;

5 Answers   Accenture, TCS,


What is wrong with this code such that it doesnt produce the input reversed? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char Space = ' '; char LineOfText; float count; LineOfText = getchar(); while ((LineOfText = getchar()) != '/n'); { count = strlen(LineOfText) - 1; while (count >= 0) { putchar(LineOfText[count]); count--; } } getchar(); return 0; }

2 Answers  


difference between function & structure

9 Answers   Verizon,


Categories