头文件
#include
例如:
strcpy(str2,str1)
把str1中的字符复制到str2中。
12
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <time.h>
/*把从src地址开始的字符串复制到以dest开始的字符串中*/
char* strcopy (char* dest, char *src) {
char* r = dest
while((*r++ = *src++)!='\0')
return dest
}
int main () {
char *str1="abcde"
char *str2
str2 = strcopy (str2, str1)/*把str1复制到str2*/
puts (str2)
return 0
}