strcpy: copy t to s;
pointer version;
指针版本
函数接口定义:
void strcpy( char *restrict dest, const char *restrict src );
裁判测试程序样例:
#include<stdio.h>void strcpy( char *restrict dest, const char *restrict src );
char *alloc(int n);int main()
{char *from = alloc(1000);char *to = alloc(1000);while(~scanf("%s", from)) {strcpy(to, from);printf("%s\n", to);}return 0;
}/* 请在这里填写答案 */
输入样例:
abc
结尾无空行
输出样例:
abc
结尾无空行
void strcpy( char *restrict dest, const char *restrict src ){while(*src!='\0'){*dest=*src;dest++;src++;}*dest='\0';
}