码迷,mamicode.com
首页 > 其他好文 > 详细

自己实现strcat函数的功能。(假如字符数组足够大)

时间:2014-09-22 22:12:53      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:io   ar   for   c   r   har   函数   print   ca   

#include <stdio.h>
#include <string.h>
/*
自己实现strcat函数的功能。(假如字符数组足够大)
*/

void main()
{
char str1[100] = "helloworld";
char str2[100] = "world";
int i = 0;
int index = strlen(str1);

for(i = 0; i <= strlen(str2); i++)
{
str1[index + i] = str2[i];
}

printf("%s\n",str1);
}

自己实现strcat函数的功能。(假如字符数组足够大)

标签:io   ar   for   c   r   har   函数   print   ca   

原文地址:http://www.cnblogs.com/zhouyi404/p/3986630.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!