Microsoft C far pointer dereferencing

Richard Hancock richardh at hpopd.HP.COM
Fri Aug 17 19:28:00 AEST 1990


/ hpopd:comp.lang.c / mfinegan at uceng.UC.EDU (michael k finegan) / 10:30 pm  Aug 16, 1990 /

>PutPixel (int x, int y, unsigned char c)
>{
>  unsigned char far *mem;

>  FP_SEG (mem) = 0xa000;
>  FP_OFF (mem) = 320 * y + x;

>  *mem = c;		/* <-- this line gives a run-time error */
>}

Why not use

  *((unsigned char far *)(0xA0000000L + 320*y + x)) = c;



More information about the Comp.lang.c mailing list