Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mit-eddie!bloom-beacon!eru!hagbard!sunic!news.funet.fi!news From: pl@news.funet.fi.tut.fi (Lehtinen Pertti) Newsgroups: comp.lang.c Subject: Re: Why 'life after free'. Message-ID: <1990Oct2.104509.1744@funet.fi> Date: 2 Oct 90 10:45:09 GMT References: <1990Sep30.163824.12974@ibmpcug.co.uk> Sender: news@funet.fi (#News ) Distribution: comp Organization: Finnish University and Research Network FUNET Lines: 28 From article <1990Sep30.163824.12974@ibmpcug.co.uk>, by dylan@ibmpcug.co.uk (Matthew Farwell): > > Forgive me if I'm wrong, but whats wrong with doing .... > > char * > funny(c) > char c; > { > static char a[100]; > int i; > > for (i=0 ; i<99 ; i++) a[i] = c; > a[99] = '\0'; > return (&a[0]); > } > With this function call's like printf( "%s %s\n", funny( 'x' ), funny( 'y' ) ); do not work as expected. --- pl@tut.fi ! All opinions expressed above are Pertti Lehtinen ! purely offending and in subject Tampere University of Technology ! to change without any further Software Systems Laboratory ! notice