函数strcat(str1,str2)的功能是把字符串
函数strcat(sr1,str2)的功能是把字符串str2拼接到字符串str1的后面。其中str1和str2都必须以'\0'结束,同时··· ···
那个str1和str2都必须以'\0'结束是什么意思,难道还有不是以'\0'结束的字符串?
[解决办法]
看函数原型,要求这样的参数而已!
char *strcat( char *strDestination, const char *strSource );
Parameters
strDestination
Null-terminated destination string
strSource
Null-terminated source string
Libraries
All versions of the C run-time libraries.
Return Value
Each of these functions returns the destination string (strDestination). No return value is reserved to indicate an error.
Remarks
The strcat function appends strSource to strDestination and terminates the resulting string with a null character. The initial character of strSource overwrites the terminating null character of strDestination. No overflow checking is performed when strings are copied or appended. The behavior of strcat is undefined if the source and destination strings overlap.