modification of strings

Henry Spencer henry at utzoo.uucp
Thu Feb 9 08:20:46 AEST 1989


In article <345 at lakesys.UUCP> chad at lakesys.UUCP (D. Chadwick Gibbons) writes:
>... Insofar as I have been told, strings can not
>be modified - note, the type char *blah = "this is a string"; not the everyday
>normal strings we use.  This would appear that if you attempted to modify
>their contents, you would either get a core dump of some various flavor, or
>the program would ignore your request...

Not quite; the situation is that either of those things, or something much
more bizarre, can happen.  Note, "can", not "will".  Civilized/portable
programs should never attempt to modify a string literal.  The effects of
trying to modify one are entirely unpredictable.
-- 
Allegedly heard aboard Mir: "A |     Henry Spencer at U of Toronto Zoology
toast to comrade Van Allen!!"  | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list