Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: modification of strings Message-ID: <1989Feb8.222046.26889@utzoo.uucp> Organization: U of Toronto Zoology References: <345@lakesys.UUCP> Date: Wed, 8 Feb 89 22:20:46 GMT In article <345@lakesys.UUCP> chad@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@zoo.toronto.edu