returning automatic variables

Phil Howard KA9WGN phil at ux1.cso.uiuc.edu
Sat May 25 11:21:23 AEST 1991


nnj20229 at uxa.cso.uiuc.edu (Nesha Nicole Jones) writes:

>I wrote the following simple program and when it runs I get the following 
>output.  Is it possible to return an automatic string form a function
>because I cannot get it to work.

No.  Either allocate a string (and be sure to free it) or use static.
In the case of static, the contents of the string will change the next
time your function is used.

BTW, what if I type in more than 99 characters into your string?
-- 
 /***************************************************************************\
/ Phil Howard -- KA9WGN -- phil at ux1.cso.uiuc.edu   |  Guns don't aim guns at  \
\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks  |  people; CRIMINALS do!!  /
 \***************************************************************************/



More information about the Comp.lang.c mailing list