Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: returning automatic variables
Message-ID: <1991May24.165049.29063@zoo.toronto.edu>
Date: Fri, 24 May 1991 16:50:49 GMT
References: <1991May24.153133.13590@ux1.cso.uiuc.edu>
Organization: U of Toronto Zoology

In article <1991May24.153133.13590@ux1.cso.uiuc.edu> nnj20229@uxa.cso.uiuc.edu (Nesha Nicole Jones) writes:
>... Is it possible to return an automatic string form a function...

Basically, no.  The string has to be contained in storage that will survive
after the function returns.  Automatic variables don't.  You either have to
use a static buffer for the returned value, or use malloc().
-- 
And the bean-counter replied,           | Henry Spencer @ U of Toronto Zoology
"beans are more important".             |  henry@zoo.toronto.edu  utzoo!henry
