Tuesday 2 September 2008

Far pointer questions with solution

(1) What will be output ?
void main()
{
char far *p=(char far *)0x55550005;
char far *q=(char far *)0x53332225;
clrscr();
*p=25;
(*p)++;
printf("%d",*q);
getch();
}
Output: 26
Explanation:
Far address of p and q are representing same physical address .
Physical address of 0x55550005= 0x5555*ox10+ox0005= 0x55555
Physical address of 0x53332225=0x5333*0x10+ox2225=0x55555
*p =25, means content at

No comments:

Post a Comment