小弟是C初學者
剛剛學到strcat()
以下是我的程式碼
http://codepad.org/IOCuy2Fa
我的疑問是
為何
printf("%s\n",string1); // 執行得很OK
但是
printf("%s\n",strcat(string1,string2)); //執行結果很奇怪
因為不是出現預期的"You are all my good friends."
而是出現"You are all my good friends.good friends."
為何重複了string2的內容
請問是哪裡錯了
請高人指點
謝謝
※ 編輯: ot15 來自: 61.227.130.139 (04/03 23:15)
推
04/03 23:16, , 1F
04/03 23:16, 1F
→
04/03 23:16, , 2F
04/03 23:16, 2F
→
04/03 23:17, , 3F
04/03 23:17, 3F
→
04/03 23:17, , 4F
04/03 23:17, 4F
→
04/03 23:17, , 5F
04/03 23:17, 5F
→
04/03 23:18, , 6F
04/03 23:18, 6F