Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site genrad.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!john From: john@genrad.UUCP (John Nelson) Newsgroups: net.lang.c Subject: Re: Lattice/UNIX incompatibility Message-ID: <580@genrad.UUCP> Date: Fri, 4-Jan-85 11:31:08 EST Article-I.D.: genrad.580 Posted: Fri Jan 4 11:31:08 1985 Date-Received: Sat, 5-Jan-85 04:15:13 EST References: <345@rna.UUCP> <6971@brl-tgr.ARPA> Reply-To: john@genrad.UUCP (John Nelson) Organization: GenRad, Inc., Bolton, Mass. Lines: 19 >> >> 7. Identical strings are stored together. (I doubt that >> this would cause many problems.) >> >Boy does this cause problems. My application overwrites the string. >When I wanted to do it twice I did something like > char *str1 = "../../.."; > char *str2 = "../../.."; > defining these two strings as: char str1[] = "../../.."; char str2[] = "../../.."; avoids the problem. This defines two arrays (seperate storage) initialized to be the value of the string, rather than two pointers to string storage. I think that it is rather chancy to overwrite string literals, in any case.