level 12
别墨迹☞☜
楼主
大家都知道C中的strcpy()函数是用来复制字符串的库函数。先附上代码看看strcpy()函数的功能:

1 #include<stdio.h>
2 #include<
string.h>
3
#define MAX 20
4
5
int main(
void
)
6
{
7
char a[MAX]=
"
abc
"
;
8
char b[MAX]=
"
abcdefghi
"
;
9
strcpy(a,b);
10
puts(a);
11
puts(b);
12 }

很明显,结果如下:

此函数中还有两个高级属性—— ①:它是char *类型,它返回的是第一个参数的值,即一个字符的地址。 ②:第一个参数不需要指向数组的开始。
先附上代码来说明这两个属性:

1 #include<stdio.h>
2 #include<
string.h>
3
#define MAX 40
4
5
int main(
void
)
6
{
7
char *a=
"
beast
"
;
8
char b[MAX]=
"
you are the beast one.
"
;
2012年11月21日 08点11分
1
1 #include<stdio.h>2 #include<
string.h>
3
#define MAX 20
4
5
int main(
void
)
6
{
7
char a[MAX]=
"
abc
"
;
8
char b[MAX]=
"
abcdefghi
"
;
9
strcpy(a,b);
10
puts(a);
11
puts(b);
12 }
很明显,结果如下: 
此函数中还有两个高级属性—— ①:它是char *类型,它返回的是第一个参数的值,即一个字符的地址。 ②:第一个参数不需要指向数组的开始。先附上代码来说明这两个属性:
1 #include<stdio.h>2 #include<
string.h>
3
#define MAX 40
4
5
int main(
void
)
6
{
7
char *a=
"
beast
"
;
8
char b[MAX]=
"
you are the beast one.
"
;

