#include < stdio.h> #include < stdlib.h>
char* strcat_self(char *strFrist,char *strSecond){ int i=0,j=0; static char newstr[20]; char *p; p = newstr; while(*(strFrist+i)!=’/0’){ (p+i) = (strFrist+i); i++; } while(*(strSecond+j)!=’/0’){ (p+i) = (strSecond+j); i++; j++; } return newstr; } int main() { char str1[20],str2[20],*newstr; PRintf(“請(qǐng)輸入第一個(gè)字符串:/n”); gets(str1); printf(“請(qǐng)輸入第二個(gè)字符串:/n”); gets(str2); newstr = strcat_self(str1,str2); printf(“字符串1:%s 字符串2:%s 連接后:%s/n”,str1,str2,newstr); return 0; }
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注