More actions
No edit summary |
No edit summary |
||
| Line 10: | Line 10: | ||
} | } | ||
== 1-2 == | == 1-2 == | ||
//strcpy | |||
char strlen(char* dest) { | |||
int length = 0; | |||
for (int i = 0; dest[i] != '\0'; i++) { | |||
length++; | |||
} | |||
return length; | |||
} | |||
== 1-3 == | == 1-3 == | ||
== 1-4 == | == 1-4 == | ||
Revision as of 00:06, 12 November 2020
1
//strcpy
char strcpy(char* dest, char* source) {
char* dptr = dest;
do {
*dptr++ = *(source++);
} while (*source);
return dest;
}
1-2
//strcpy
char strlen(char* dest) {
int length = 0;
for (int i = 0; dest[i] != '\0'; i++) {
length++;
}
return length;
}