Monday, July 27, 2009

What are near, far, huge Pointers in c?

I need Indepth answer.How internally the memory will be allocated.

What are near, far, huge Pointers in c?
The difference between pointers has to do with the way - for hsitoric reasons - computers allocate and address memory.





Early computers had very little memory - no more than 64k - so you could address any of it with two bytes. As computers got more memory, a decision was made to continue addressing memory in chunks that could be accessed using two bytes. This made old programs carry on working.





So to address more memory you needed a four byte pointer, but they were split into two chunks - a segment and an offset.





A near pointer is one where only the offset is used - it can only address into the current segment .





A far pointer has both components, so can address any of the 4GB addressable 32 bit space. However, you can see that the same pointer can be expressed in different ways, depending where you draw segment boundaries.





A huge pointer is a far pointer that has had as much as possible expressed in the segment.

survey research

No comments:

Post a Comment