不用stract函数,编程实现字符串连接函数stract的功能,将字符串t连接到

不用stract函数,编程实现字符串连接函数stract的功能,将字符串t连接到字符串s的尾部。

我自己写一个stract函数给你好了

void mystrcat(char *c1,char *c2){
if(c1==NULL||c2==NULL)
return;
while(*c1)c1++;
while(*(c1++)=*(c2++));
}

好了 搞定 你自己试试吧 自己在记事本里手写的

有错误的话见谅
温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-04-05
#include<stdio.h>
void mstrcat(char *s,char *t) {
  while ( *s ) s++;
  while ( *t ) { *s=*t; s++; t++; }
  *s=0;
}
void main() { char s[256]={ "1234" },t[256]={ "56789" };
  mstrcat(s,t); printf("%s\n",s);
}

相似回答