String help!
Gregory J.E. Rawlins
gjerawlins at watdaisy.UUCP
Wed Feb 27 14:57:36 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"..
In article <929 at ukma.UUCP> david at ukma.UUCP (David Herron, NPR Lover) writes:
> 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.
In article <437 at ark.UUCP> huisjes at ark.UUCP (Michiel Huisjes) writes:
> David Herron is right, except for the fact that you are allowed to
> change the contents of the string as long as you don't change the
> length of it!
(a confused hon-hacker writes...) Why would you want to keep a pointer to
a constant string (or at least a constant length string)??
--
Gregory Rawlins CS Dept.,U.Waterloo,Waterloo,Ont.N2L3G1 (519)884-3852
gjerawlins%watdaisy at waterloo.csnet CSNET
gjerawlins%watdaisy%waterloo.csnet at csnet-relay.arpa ARPA
{allegra|clyde|linus|inhp4|decvax}!watmath!watdaisy!gjerawlins UUCP
More information about the Comp.lang.c
mailing list