正在加载图片...
1串连接 串连接是把两个串s1和s2首尾连接成一个新串s。 int StrConcatl(sl, s2, s) char sllls2ll, sl; i int i=0,j, lenl, len2 lenl-StrLength(s1); len2= StrLength(s2) if (lenI+len2> MAXSIZE-) return0;/*s长度不够 while(sl[j=10) [ sil=s1[i]; i++,j++, i while(s2[i=\0) s[i=s2j];i++;j++;} ]= return 2021年1月21日 数据结构讲义 132021年1月21日 数据结构讲义 13 ⒈串连接 串连接是把两个串s1和s2首尾连接成一个新串s。 int StrConcat1(s1,s2,s) char s1[ ],s2[ ],s[ ]; { int i=0 , j, len1, len2; len1= StrLength(s1); len2= StrLength(s2) if (len1+ len2>MAXSIZE-1) return 0 ; /* s长度不够*/ j=0; while(s1[j]!=’\0’) { s[i]=s1[j]; i++; j++; } j=0; while(s2[j]!=’\0’) { s[i]=s2[j]; i++; j++; } s[i]=’\0’; return 1; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有