December 2002
Intermediate to advanced
1616 pages
39h 57m
English
| 10. | Assume that your buffer contains the C code shown here, with the Major mode set for C and the cursor positioned at the end of the while line as shown by the black square:
/*
* Copy string s2 to s1. s1 must be large enough
* return s1
*/
char *
strcpy(s1, s2)
register char *s1, *s2;
{
register char *os1;
os1 = s1;
while (*s1++ = *s2++)
;
return(os1);
}
/* Copy source into dest, stopping after '\0' is copied, and
return a pointer to the '\0' at the end of dest. Then our caller
can concatenate to the dest string without another strlen call. */
char *
stpcpy (dest, source)
char *dest;
char *source;
{
while ((*dest++ = *source++) != '\0') ▀
; /* void loop body */
return (dest - 1);
}
|
Read now
Unlock full access