六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 35|回复: 0

自己写strcat函数,有点小问题

[复制链接]

升级  0.33%

57

主题

57

主题

57

主题

举人

Rank: 3Rank: 3

积分
201
 楼主| 发表于 2013-1-27 04:52:59 | 显示全部楼层 |阅读模式
reading the book of 《the C programing language》,write a program by myself about strcat,but here is a mistake. I recode the program here in order to find the causation in future.
 
 
#include <stdio.h>void myStrcat(char s[],char t[]){int i=0,j=0;while(s != '\0') i++;while((s[i++]=t[j++]) != '\0');}int main(){char s[]="abde";char t[]="word!";myStrcat(s,t);    printf("%s\n",s);} I guess the problem is the memory of allocation.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表