【頭文件】#include <string.h>
【原型】
1 |
|
【參數】: dest 爲目標字符串指針,src 爲源字符串指針。
strcat() 會將參數 src 字符串複製到參數 dest 所指的字符串尾部;dest 最後的結束字符 NULL 會被覆蓋掉,並在連接後的字符串的尾部再增加一個 NULL。
【注意】 dest 與 src 所指的內存空間不能重疊,且 dest 要有足夠的空間來容納要複製的字符串
【返回值】 返回dest 字符串起始地址。
【實例】連接字符串並輸出。
1 2 3 4 5 6 7 8 9 10 11 12 |
|
輸出結果:
these strings are concatenated.
Ref: