Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!dsill@NSWC-OAS.arpa From: dsill@NSWC-OAS.arpa (Dave Sill) Newsgroups: comp.lang.c Subject: Re: strcpy Message-ID: <12622@brl-adm.ARPA> Date: 24 Mar 88 19:32:25 GMT Sender: news@brl-adm.ARPA Lines: 30 From article <793@cresswell.quintus.UUCP>, by ok@quintus.UUCP (Richard A. O'Keefe): > 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 I think you're misinterpreting that statement. I don't think that statement says anything about the order in which the characters are copied or that the NUL is copied last. As we all know, a string in C is a pointer to a list of characters that, by convention, is terminated by a NUL character. Given a string, the ONLY way to determine its contents or length is to start at the beginning and scan for the terminating NUL. The statement above is merely restating the NUL-terminator convention. I don't think it was intended to specify the actual order in which the characters are copied. Of course, with C's string representation, copying from beginning to end is more efficient than finding the end of the source string and copying backward. ========= The opinions expressed above are mine. "We are offended and resent it when people do not respect us; and yet no man, deep down in his heart, has any considerable respect for himself." -- Mark Twain