Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!uw-beaver!uw-june!roper From: roper@uw-june.UUCP (Michael Roper) Newsgroups: comp.sys.ibm.pc Subject: MSC 4.0 and the Twilight Zone Message-ID: <2454@uw-june.UUCP> Date: Sun, 3-May-87 17:10:53 EDT Article-I.D.: uw-june.2454 Posted: Sun May 3 17:10:53 1987 Date-Received: Sun, 3-May-87 21:56:42 EDT Organization: U of Washington, CSCI, Seattle Lines: 48 Can anyone please explain the behavior of the following few lines of code? It compiles without errors, and as written produces these two output lines: where 'arg' is the first string entered on the command line, and '+' is the printable representation of ^L (the symbol for female). The two output lines should be identical. If the source line in main is changed from "strcat (s, ".U");" to "strcat (s, ".X");", the expected output is produced: What am I missing? -------- #include #include do_nothing (arg_string) char *arg_string; { char *dont_care_str; printf ("<%s>\n", arg_string); dont_care_str = strdup ("don't care"); printf ("<%s>\n", arg_string); } main (argc, argv) int argc; char *argv[]; { char *s; s = strdup (argv[1]); strcat (s, ".U"); do_nothing (s); } -- ---Michael Roper--- * * "Calvin, do you believe in God?" ARPA: roper@june.cs.washington.edu * UUCP: ihnp4!uw-beaver!uw-june!roper * "Well...SOMEBODY is out to get me."