Is ``char c; strcpy(&c,"");'' ANSI C?
Wolfgang Deifel
wolfgang at ruso.UUCP
Mon Aug 28 16:46:53 AEST 1989
mike at 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.
More information about the Comp.lang.c
mailing list