Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rtech.ARPA Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!zehntel!dual!unisoft!mtxinu!rtech!jeff From: jeff@rtech.ARPA (Jeff Lichtman) Newsgroups: net.lang.c Subject: Re: String help! Message-ID: <194@rtech.ARPA> Date: Fri, 1-Mar-85 02:35:25 EST Article-I.D.: rtech.194 Posted: Fri Mar 1 02:35:25 1985 Date-Received: Sun, 3-Mar-85 03:06:56 EST References: <8257@watarts.UUCP> <929@ukma.UUCP> <437@ark.UUCP> Organization: Relational Technology, Berkeley CA Lines: 26 > > 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! > So you are allowed to say: > > main() > { > char *ptr; > char *foo(); > > ptr = foo(); > strcpy( ptr, "barfoo" ); > ..... > } > -- > > Michiel Huisjes. > {seismo|decvax|philabs}!mcvax!vu44!ark!huisjes In DEC C, string constants are read-only. They are in a special, write- protected psect. If you try to do something like the above, you will get a run-time error. -- Jeff Lichtman at rtech (Relational Technology, Inc.) aka Swazoo Koolak