不用strcat连接两个字符串_字符串连接不用strcat

因为你代码能将两个字符串拼接起来,但是输出时却输出了其他的字符,所以就可以知道 将 em 两个 /em em 字符串 /em em 连接 /em 起来,不要用 em strcat /em em 函数 /em 。

分号多了 #include<stdio.h> int main() { int i,j; char a[40],b[40],c[80]; printf("input the first string:\n"); gets(a); printf("input the second string:\n"); gets(b); for(i=0;a[i]!='\0';i++) c[i]=a[i]; for(j=0;b[j]!='\0';j++) c[i+j]=b[j]; c[i+j] = '\0'; puts(c); return 0; }

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 th

连接两个字符串,不用strcat 2014年10月29日 15:59:40 爱听音乐的孩纸阅读数:4952 #i printf( 任意输入两个字符串,编写函数,实现串的连接。函数原型如下:\n ); printf( void str_

#include<stdio.h> void main() { void joint(char a[],char b[],char c[]); char x[100]; char y[100]; char z[200]; printf("输入第一个:"); scanf("%s",x); printf("输入第二个:"); scanf("%s",y); joint(x,y,z); printf("%s\n",z); } void joint(char a[],char b[],char c[]) { int i,j; for(i=0;a[i]!='\0';i++) c[i]=a[i]; for(j=0;b[j]!='\0';j++) c[i+j]=b[j]; c[i+j]='\0'; }

不用strcat函数将两个字符串连接起来 程序代码: #include stdafx.h #include string.h int _tmain(int argc, _TCHAR* argv) { char a[100]; char b[100]; char c[100]; scanf_s( %s%s ,a[

其实查过strcat和strncat以及strcpy,strncpy这类的函数是不安全的~简单来说因为可能会有越界的可能~liux环境下提供了较为安全的strlcat和strlcpy,当然没有这两个函数的编译环

void main(){ char s1[80],s2[40]; int i=0,j=0; gets(s1); gets(s2); while(s1[i++]!='\0'); i--; while((s1[i++]=s2[j++])!='\0'); printf("%s",s1); }

明显是作业题

用指针方案编写一个将两个字符串连接起来的函

用指针方案编写一个将两个字符串连接起来的函

500x224 - 15KB - JPEG

c++读入两个字符串,再把他们连接起来,生成一

c++读入两个字符串,再把他们连接起来,生成一

521x396 - 14KB - PNG

将两个字符串连接起来 不要用strcat函数运行结

将两个字符串连接起来 不要用strcat函数运行结

215x180 - 12KB - JPEG

c++ 用链表连接两个字符串_百度知道

c++ 用链表连接两个字符串_百度知道

379x291 - 26KB - JPEG

c++ 用链表连接两个字符串_百度知道

c++ 用链表连接两个字符串_百度知道

348x239 - 21KB - JPEG

C++怎样把两个字符串连接在一起? - 已解决 -

C++怎样把两个字符串连接在一起? - 已解决 -

500x342 - 23KB - JPEG

C语言,连接两个字符串,这个对吗?讲一下while开

C语言,连接两个字符串,这个对吗?讲一下while开

768x1024 - 81KB - JPEG

Python连接两个字符串并去除首尾重复子串

Python连接两个字符串并去除首尾重复子串

512x512 - 11KB - JPEG

用字符串连接的两个锡罐

用字符串连接的两个锡罐

1024x768 - 92KB - JPEG

看图片进行编写VB两个字符串连接程序

看图片进行编写VB两个字符串连接程序

417x523 - 29KB - JPEG

谁能告诉我这为什么不能试行? 我不用字符串连

谁能告诉我这为什么不能试行? 我不用字符串连

493x513 - 47KB - JPEG

11.7.2 将两个字符串连接后输出 - 51CTO.COM

11.7.2 将两个字符串连接后输出 - 51CTO.COM

499x202 - 16KB - JPEG

C 中将两个字符串连接起来组成一个字符串的函

C 中将两个字符串连接起来组成一个字符串的函

229x487 - 11KB - JPEG

C 中将两个字符串连接起来组成一个字符串的函

C 中将两个字符串连接起来组成一个字符串的函

367x293 - 12KB - JPEG

菜鸟C语言难题之字符串连接?_编程 - QQ志乐

菜鸟C语言难题之字符串连接?_编程 - QQ志乐

464x357 - 25KB - JPEG

大家都在看

相关专题