strcpy函数式怎么使用的?求解具体的运行方式,
越详细越好,新手一枚,老师没有讲,也不准备讲……
2012-12-19 20:55

2012-12-19 23:24
2012-12-20 11:40
2012-12-20 11:55
2012-12-20 22:45
程序代码:
/* STRCPY.C: This program uses strcpy
* and strcat to build a phrase.
*/
#include <string.h>
#include <stdio.h>
void main( void )
{
char string[80];
strcpy( string, "Hello world from " );
strcat( string, "strcpy " );
strcat( string, "and " );
strcat( string, "strcat!" );
printf( "String = %s\n", string );
}
2012-12-20 22:46
2012-12-20 22:48
2012-12-21 22:34
2012-12-22 10:11
程序代码: * C语言标准库函数strcpy的一种典型的工业级的最简实现
* 返回值:
* 返回目标串的地址。
* 对于出现异常的情况ANSI-C99标准并未定义,故由实现者决定返回值,通常为NULL。
* 参数:
* strDestination
* 目标串
* strSource
* 源串
***********************/
char *strcpy(char *strDestination,const char *strSource)
{
assert(strDestination!=NULL && strSource!=NULL);
char *strD=strDestination;
while ((*strDestination++=*strSource++)!='\0');
return strD;
}百度百科

2012-12-24 17:43