Why 'life after free'.
Lehtinen Pertti
pl at news.funet.fi.tut.fi
Tue Oct 2 20:45:09 AEST 1990
>From article <1990Sep30.163824.12974 at ibmpcug.co.uk>, by dylan at 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 at 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
More information about the Comp.lang.c
mailing list