/* strcpy takes in two character pointers (i.e. the addresses of two strings), and copies the second string to the location of the first. The function returns the address of the first string. */ char * strcpy(char * s1, const char * s2) { int i; for (i = 0; s2[i] != '\0'; i++) s1[i] = s2[i]; s1[i] = s2[i]; // copy the terminator return s1; } char * strcpy(char * s1, const char * s2) { char* temp = s1; while (*s2) *s1++ = *s2++; *s1 = *s2; // copy the terminator return temp; }