top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is location of huge pointer in C language in Memory?

+3 votes
167 views
What is location of huge pointer in C language in Memory?
posted Dec 5, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

3 Answers

+1 vote

We need to understand it in the context of far pointer -

Both Far and huge pointers have a size of 4 bytes. They store both the segment and the offset of the address the pointer is referencing.

We cannot change or modify the segment address of given far address by applying any arithmetic operation on it. That is by using arithmetic operator we cannot jump from one segment to other segment.If you will increment the far address beyond the maximum value of its offset address instead of incrementing segment address it will repeat its offset address in cyclic order. See the following example (only applicable to old x86 platform)

int main()
{
    char far* f=(char far*)0x0000ffff;
    printf("%Fp",f+0x1);
    return 0;
}
Output 
0x00000000

When a far pointer is incremented or decremented ONLY the offset of the pointer is actually incremented or decremented but in case of huge pointer both segment and offset value will change as the following

int main()
{
    char huge* f=(char huge*)0x0000ffff;
    printf("%Fp",f+0x1);
    return 0;
}
Output 
0x00010000
answer Dec 6, 2015 by Salil Agrawal
+1 vote

A far pointer was composed of a segment as well as an offset but no normalisation was performed. And a huge pointer was automatically normalised. Two far pointers could conceivably point to the same location in memory but be different whereas the normalised huge pointers pointing to the same memory location would always be equal.

answer Dec 6, 2015 by Rajan Paswan
0 votes

The pointer which can point or access whole the residence memory of RAM i.e. which can access all the 16 segments is known as huge pointer.
Size of huge pointer is 4 byte or 32 bit.

enter image description here

answer Dec 5, 2015 by Amit Kumar Pandey
Similar Questions
+4 votes

What is the point of declaring Pointer of different types (eg. integer,float,char) as we all know pointer takes 4 bytes of space regardless which type of pointer it is and only contains address?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...