Xref: utzoo alt.msdos.programmer:576 comp.sys.ibm.pc:37173 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!dino!atanasoff!jwright From: jwright@atanasoff.cs.iastate.edu (Jim Wright) Newsgroups: alt.msdos.programmer,comp.sys.ibm.pc Subject: Re: Turbo C far pointers Message-ID: <1711@atanasoff.cs.iastate.edu> Date: 28 Oct 89 19:08:15 GMT References: <565@titan.tsd.arlut.utexas.edu> Reply-To: jwright@atanasoff.cs.iastate.edu (Jim Wright) Organization: Iowa State U. Computer Science Department, Ames, IA Lines: 36 In a recent posting elrond@titan.tsd.arlut.utexas.edu (Brad Hlista) writes: | I am having a problem of getting an allocated block of far memory | to return float values. Here is how variables are declared and dereferenced: | far *ptr; I think this is the big part. An int pointer is not the same as a float pointer. The following program works for me (MSC). #include #include int main(void); int main() { int i; float far *start; float far *p; start = (float far *) _fmalloc(1000*sizeof(float)); if (start != NULL) { printf("Good.\n"); for (p=start,i=0 ; i<1000 ; i++) *(p++) = 3.1415927; for (p=start,i=0 ; i<10 ; i++) printf("%f\n", *(p++)); } else printf("Oh shit.\n"); return(0); } -- Jim Wright jwright@atanasoff.cs.iastate.edu