Path: utzoo!mnetor!uunet!husc6!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: strcpy Message-ID: <793@cresswell.quintus.UUCP> Date: 22 Mar 88 07:14:12 GMT References: <7712@apple.Apple.Com> <7485@brl-smoke.ARPA> <10731@mimsy.UUCP> <10753@mimsy.UUCP> Organization: Quintus Computer Systems, Mountain View, CA Lines: 13 The UNIX manuals say of strcpy(s1, s2) that it "copies s2 to s1, stopping after the null character has been copied." While they doesn't strictly speaking say anything about the order in which the other characters are copied, they _do_ say that the NUL character must be copied last, so char *strcpy(char *dst, *src) { int n = strlen(src) + 1; dst += n, src += n; while (--n >= 0) *--dst = *--src; return dst; } is clearly illegal (it copies the NUL first).