Path: utzoo!attcan!uunet!mcsun!unido!rwthinf!ruso!wolfgang From: wolfgang@ruso.UUCP (Wolfgang Deifel) Newsgroups: comp.lang.c Subject: Re: Is ``char c; strcpy(&c,"");'' ANSI C? Message-ID: <1003@ruso.UUCP> Date: 28 Aug 89 06:46:53 GMT References: <30@looney.twinsun.com> <1619@cbnewsl.ATT.COM> <4949@thor.acc.stolaf.edu> Organization: Dr. Ruff Software GmbH, Aachen, W.Germany Lines: 18 mike@thor.acc.stolaf.edu (Mike Haertel) writes: >/* strcpy that doesn't compute &c + 1 */ >char * >strcpy(char *s, const char *t) >{ > char *r = s, c; > while (c = *t) > *s++ = c; > return r; >} I think your strcpy doesn't work. First you don't increment 't', ( while (c = *t) is a 'loop-forever' if you don't modify t ), and second, if you increment t the null-character isn't copied. Wolfgang.