欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: strcpy函數實現及簡單應用 [打印本頁]

作者: xiaojuan    時間: 2014-9-24 22:34
標題: strcpy函數實現及簡單應用

//:Vc++6.0  String  strcpy函數
//功能:字符串的拷貝
//參數:dest 目標字符串  str 要拷貝的字符串
//返回值:目標字符串
#include<stdio.h>

char *strcpy(char *dest, const char *str);

int main ()
{
char *str = "hello world";
char buf[22] = {0};

printf("buf: %s\n", strcpy(buf, str));

return 0;
}

char *strcpy(char *dest, const char *str)
{
if (dest == NULL || str == NULL)
{
perror("dest or str");
return NULL;
}

char *temp = dest;
while (*str != '\0')
*temp++ = *str++;
*temp = '\0';
return dest;
}
//在vc++6.0中的運行結果為:buf: hello world//:~







歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1