Thursday, December 25, 2008

Huge pointer in C program Question with Answers

Q1.What will be output ?

void main()
{
int huge *a=(int huge *)0x59990005;
int huge *b=(int huge *)0x59980015;
if(a==b)
printf("power of pointer");
else
printf("power of c");
getch();
}
Output: power of pointer
Explanation:
Here we are performing relational operation between two huge address.
So first both a and b will normalize.
a=(0x5999)* (0x10)+(0x0005)=0x9990+0x0005=0x9995
b=(0x5998)* (0x10)+(0x0015)=0x9980+0x0015=0x9995
Here both huge address is representing same physical address. So a==b is true.

No comments:

Blog List