String help!

David Herron, NPR Lover david at ukma.UUCP
Thu Feb 21 08:51:04 AEST 1985


In article <8257 at watarts.UUCP> upen at watarts.UUCP (Ue-Li Pen) writes:
> Is it allowed & portable to use the construct:
> char* foo(){
> return("foobar");    
> }
> This would hopefully return a pointer to the string "foobar"..

Yes it does....However it is a pointer to a STATIC data area.
So it wouldn't be a good idea to change the contents of the string.
-- 
-:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:-
-:-David Herron;
-:-ARPA-> "ukma!david"@ANL-MCS or david%ukma.uucp at anl-mcs.arpa
-:-ARPA-> Or even anlams!ukma!david at ucbvax.arpa
-:-UUCP-> {ucbvax,unmvax,boulder,research}!anlams!ukma!david
-:-UUCP-> {mcvax!qtlon,vax135,mddc}!qusavx!ukma!david
-:-UUCP-> {A-Large-Portion-of-The-World}!cbosgd!ukma!david



More information about the Comp.lang.c mailing list