Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!umd5!jupiter.astro.umd.edu!jjk From: jjk@jupiter.astro.umd.edu (Jim Klavetter) Newsgroups: comp.lang.c Subject: do I need to allocate space twice? Message-ID: <8338@umd5.umd.edu> Date: 29 Mar 91 22:03:41 GMT Sender: news@umd5.umd.edu Reply-To: jjk@astro.umd.edu (Jim Klavetter) Distribution: na Organization: U of Md., Astronomy Program Lines: 41 I have a function which returns a pointer of type double. This is really an "array". Should the main program or the function allocate the space? Does it matter? Certainly, I don't need to allocate space twice, right? To make this clear, here is a simple example: add two arrays: double *addarray(a, b, n) double *a, *b; int n; { int i; double *result; for(i=0; i