#include //printf
#include //malloc
#include //strlen
char * sstrcpy(char * strdst, char * strsrc)
{
char *dst = strdst;
assert(strdst!=NULL && strsrc!=NULL);
while((*strdst++ = *strsrc++)!= '\0')
NULL;
return dst; //实现链式表达式
}
//int num = strlen(strcpy(strdst,"hello world"));
int main(void)
{
int num;
char *strdst = (char *)malloc(sizeof(char)*100);
if(strdst == NULL)
return (-1);
num = strlen(sstrcpy(strdst,"hello world"));
printf("%d\n", num);
return 0;
}
阅读(2242) | 评论(0) | 转发(0) |