#What does strcat mean in C language?
strcat represents a function for appending strings in C language. Its function is to append string A to the end of string B. The value of string A remains unchanged and the string B becomes longer. When appending, you need to ensure that the B string cannot overflow after adding A.
strcat declaration
The following is the declaration of strcat() function.
char *strcat(char *dest, const char *src)
strcat Parameter
dest -- Points to the target array, which contains a C string and is large enough to accommodate the appended string.
src -- Points to the string to be appended, which will not overwrite the target string.
strcat return value
This function returns a pointer to the final target string dest.
strcat example
#include <stdio.h> #include <string.h> int main () { char src[50], dest[50]; strcpy(src, "This is source"); strcpy(dest, "This is destination"); strcat(dest, src); printf("最终的目标字符串: |%s|", dest); return(0); }
Compiled and run results
最终的目标字符串: |This is destinationThis is source|
Recommended tutorial: "C#"
The above is the detailed content of What does strcat mean in C language?. For more information, please follow other related articles on the PHP Chinese website!