Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explain the difference between near, far and huge pointers in c? [duplicate]

Tags:

c

pointers

Possible Duplicate:
difference between far pointer and near pointer in C

I searched in GOOGLE for the difference between these three pointers. But I found out the difference between any of the two pointers.

Can you give Detailed Explanation of this please?

like image 222
Karai Avatar asked Jan 04 '12 12:01

Karai


1 Answers

The differences are only relevant on 16 bit intel architectures.

As far as virtual addresses is concerned, It has two components - a selector and an offset.

The selector is an index into a table of base addresses and offset is added onto that base address.

near pointers don't have a selector - they have an implied selector. They can access 64k off the virtual address space.

far pointers have an explicit selector. However when you do pointer arithmetic on them the selector isn't modified.

huge pointers have an explicit selector. When you do pointer arithmetic on them though the selector can change.

Please Refer this link for more info:

http://www.codeproject.com/Answers/103115/near-vs-far-vs-huge-pointers/?cmt=11086#answer1

like image 50
karthik Avatar answered Nov 07 '22 19:11

karthik