Path: utzoo!attcan!uunet!ns-mx!iowasp!maverick.ksu.ksu.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!milano!uudell!texbell!merch!cpe!hal6000!trsvax!don From: don@trsvax.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: MSC 6.0 malloc question Message-ID: <292200008@trsvax> Date: 6 Jun 90 17:06:00 GMT References: <36163@sequent.UUCP> Lines: 34 Nf-ID: #R:sequent.UUCP:36163:trsvax:292200008:000:943 Nf-From: trsvax.UUCP!don Jun 6 11:06:00 1990 >Using MSC 6.0 (same results with 5.1, though) >Compact model (multiple data, one code segment) >Have an array of character pointers and a tmp declared as: > "char far *arga[8], *p" >Executing a for loop that allocates memory: > for(i=0;i if(( p = ( char *)_fmalloc(size)) == NULL) > printf("not enough memory"); > exit(1); > } > arga[i] = p; > } The problem in this code fragment has to do with the variable declarations. char far *arga[8], *p This says arga is an array of 8 char far pointers, while p is a char near pointer. To make p a far pointer, try char far *arga[8], far *p; --------------------------------------------------------------------- Marriage is like a dull meal with the dessert at the beginning. -- Toulouse-Lautrec, in _Moulin_Rouge_ Don Subt The opinions expressed above are Tandy Corp. strictly mine, not my employer's. 817-390-2923 ...!texbell!letni!rwsys!trsvax!don