Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP Path: utzoo!watmath!watdaisy!gjerawlins From: gjerawlins@watdaisy.UUCP (Gregory J.E. Rawlins) Newsgroups: net.lang.c Subject: Re: String help! Message-ID: <7014@watdaisy.UUCP> Date: Tue, 26-Feb-85 23:57:36 EST Article-I.D.: watdaisy.7014 Posted: Tue Feb 26 23:57:36 1985 Date-Received: Thu, 28-Feb-85 12:12:11 EST References: <8257@watarts.UUCP> <929@ukma.UUCP> <437@ark.UUCP> Reply-To: gjerawlins@watdaisy.UUCP (Gregory J.E. Rawlins) Organization: U of Waterloo, Ontario Lines: 22 In article <8257@watarts.UUCP> upen@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@ukma.UUCP> david@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@ark.UUCP> huisjes@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@waterloo.csnet CSNET gjerawlins%watdaisy%waterloo.csnet@csnet-relay.arpa ARPA {allegra|clyde|linus|inhp4|decvax}!watmath!watdaisy!gjerawlins UUCP