home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:12858 comp.std.c:2522
- Path: sparky!uunet!mcsun!uknet!warwick!coventry!ccx018
- From: ccx018@cch.coventry.ac.uk (Leslie Griffiths (Griff))
- Newsgroups: comp.lang.c,comp.std.c
- Subject: Re: strcpy implementation question
- Message-ID: <Btn96J.3J8@cck.coventry.ac.uk>
- Date: 27 Aug 92 13:23:06 GMT
- References: <1992Aug23.003930.9918@saaf.se> <1992Aug23.194919.22007@iecc.cambridge.ma.us> <23531@alice.att.com>
- Sender: news@cck.coventry.ac.uk (news user)
- Organization: Coventry University
- Lines: 28
- Nntp-Posting-Host: cc_sysh
-
- In article <23531@alice.att.com> ark@alice.UUCP () writes:
- >In article <1992Aug23.194919.22007@iecc.cambridge.ma.us> johnl@iecc.cambridge.ma.us (John R. Levine) writes:
- >
- >> static char buf[6];
- >
- >> strcpy(buf+3, "cd");
- >> strcpy(buf, "ab");
- >
- >> If buf doesn't end up containing "ab\0cd\0" I'd say that something was
- >> seriously wrong.
- >
- >If you make that "abcd\0", I'll agree with you.
-
- I think Mr Levine is correct. The second strcpy copies a and b to locations
- buf[0] and buf[1], and then a null, so we have:
-
- buf[0] = a, buf[1] = b, buf[2] = \0
-
- > --Andrew Koenig
-
-
- Cheers
-
-
- --
- Griff \\ ccx018@uk.ac.cov
- ^^^^^ :-= ^^^^^^^^^^^^^^^^
- //
-