The function of strcat function is to connect two char types, the code is [char d[20]="Golden";char s[20]="View";strcat(d,s);] where The memory areas pointed to by d and s cannot overlap and d must have enough space to accommodate the string of s.
The function of strcat function is to connect two char types.
For example:
char d[20]="Golden"; char s[20]="View"; strcat(d,s); //打印d printf("%s",d);
The output
d
is GoldenView (no space in the middle)
The memory areas pointed by d and s cannot overlap and d must have enough space to hold s's string.
Return the pointer to d.
Extended information
In C, the function prototype exists in the
In C, it exists in the
Copy the string pointed to by src (including "\0") to the end of the string pointed to by dest (delete the "\0" at the original end of *dest). Make sure*dest
is long enough to accommodate the copied *src. The original characters in*src
remain unchanged. Returns a pointer to dest.
Note: The memory areas pointed to by src and dest cannot overlap and dest must have enough space to accommodate the string of src.
Related learning recommendations:C video tutorial
The above is the detailed content of What is the function of strcat function?. For more information, please follow other related articles on the PHP Chinese website!