Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!europa.asd.contel.com!sura.net!haven.umd.edu!umd5!jupiter.astro.umd.edu!jjk From: jjk@jupiter.astro.umd.edu (Jim Klavetter) Newsgroups: comp.lang.c Subject: memory management between functions Summary: how? Message-ID: <8504@umd5.umd.edu> Date: 29 Apr 91 07:50:36 GMT Sender: news@umd5.umd.edu Reply-To: jjk@astro.umde.edu (Jim Klavetter) Distribution: na Organization: U of Md., Astronomy Program Lines: 67 A few weeks ago I asked about where to allocate memory, in main() or in the function. The general idea I got back was that it doesn't matter as long as you do it correctly (either place is ok). I wanted to make the functions completely autonomous, so this is what I did (in some c-like metacode) [includes] double *subtract(a, b, n) int n; double *a, *b; { int i; double *c; [malloc c array here] for(i=0; i