将两个字符串连接起来,不要用strcat函数。

2023-05-16

3、将两个字符串连接起来,不要用strcat函数。

# include <stdio.h>
int main()
{
   char str1[80],str2[40];
   int i=0,j=0;
   printf("please enter the first string:");
   gets(str1);
   printf("\nplease enter the second strings:");
   gets(str2);
   while(str1[i]!='\0')
      i++;
   while(str1[j]!='\0')
	  {
	     str1[i]=str2[j];
	     i++;
	     j++;
	  }
  str1[i]='\0';
  printf("\nAfter some  characters string is:%s \n",str1);
} 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将两个字符串连接起来,不要用strcat函数。 的相关文章

随机推荐