Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!cs.utexas.edu!samsung!usc!jarthur!petunia!polyslo!rcfische From: rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) Newsgroups: comp.sys.mac.programmer Subject: Re: malloc() and calloc() Message-ID: <260a952f.276@polyslo.CalPoly.EDU> Date: 23 Mar 90 21:29:19 GMT References: <3860@sage.cc.purdue.edu> Reply-To: rcfische@polyslo.CalPoly.EDU (Raymond C. Fischer) Distribution: usa Organization: Cal Poly State University -- San Luis Obispo Lines: 22 In article <3860@sage.cc.purdue.edu> ar4@sage.cc.purdue.edu (Piper Keairnes) writes: > > Well the last time this discussion was around, I didn't know that the >heck these two functions meant (or how C worked for that matter). Things have >changed, but I believe I'm running into the same problem that others did: > > but if CANNOT do the following: > > int *i; > > i = (int*) malloc(sizeof(int) * 6); Try using the include file that defines malloc, or using the following call ... i = (int *) malloc ((long)(sizeof(int) * 6)); malloc expects a long, and if you don't specify this somehow, the expression for the size will probably evaluate to an int. You'll be left with extra non-useful stuff on the stack being interpreted as a size. Ray Fischer rcfische@polyslo.calpoly.edu