Wrote strcpy. Not sure if working
This commit is contained in:
parent
a06d3c56a8
commit
000f24b79c
1 changed files with 15 additions and 0 deletions
15
string/strcpy.c
Executable file
15
string/strcpy.c
Executable file
|
@ -0,0 +1,15 @@
|
|||
#include <string.h>
|
||||
|
||||
char * strcpy(char * restrict dest, const char * restrict src) {
|
||||
char * to = dest;
|
||||
const char * from = src;
|
||||
size_t i;
|
||||
|
||||
for(i = 0; from[i] != '\0'; i++) {
|
||||
to[i] = from[i];
|
||||
}
|
||||
|
||||
to[i] = from[i];
|
||||
|
||||
return dest;
|
||||
}
|
Loading…
Reference in a new issue