#include "stdio.h"
int main()
{
char s[
100]=
"hello";
char b[]=
"world";
int len=mystrlen(s);
printf(
"len=%d\n",len);
mystradd(s,b);
printf(
"s=%s\n",s);
}
int mystrlen(
char s[])
{
int len=
0;
char *p=s;
while(*p)
{
len++;
p++;
}
return len;
}
void mystradd(
char s[],
char b[])
{
int len=mystrlen(s);
char *ps=&s[len];
char *pb=b;
while(*pb)
{
*ps=*pb;
ps++;
pb++;
}
}
转载请注明原文地址: https://ju.6miu.com/read-1301920.html