String help!
Jeff Lichtman
jeff at rtech.ARPA
Fri Mar 1 17:35:25 AEST 1985
>
> 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
More information about the Comp.lang.c
mailing list