C language strcat () function: connection string, strcat string
Header file: # include <string. h>
The strcat () function is used to connect strings. Its prototype is:
Char * strcat (char * dest, const char * src );
[Parameter] dest is the destination string pointer and src is the source string pointer.
Strcat () copies the src string to the end of the string indicated by the dest parameter. The end character NULL at the end of the dest parameter is overwritten, and a NULL value is added at the end of the connected string.
Note: dest and src cannot overlap the memory space, and dest must have enough space to accommodate the string to be copied.
Return Value: the start address of the dest string.
[Instance] connects the string and outputs it.
----------------------------------------------------------
# Include <stdio. h>
# Include <string. h>
Int main (void)
{
Char str [80];
Strcpy (str, "here ");
Strcat (str, "is ");
Strcat (str, "");
Strcat (str, "xiaoz ");
Puts (str );
Return 0;
}
-----------------------------------------------------------
Output result:
Here is the xiaoz
There are many string processing functions in other languages, and the string processing in C language is very troublesome.
(PS: leave a mark and use it later)