Header files: #include <string.h>
The strcat () function is used to concatenate strings whose prototypes are:
Char *strcat (char *dest, const char *SRC);
The "parameter" Dest is the destination string pointer, and SRC is the source string pointer.
strcat () copies the parameter src string to the end of the string referred to by the parameter dest, and the final end character of Dest is overwritten, and a null is added to the tail of the concatenated string.
Note: The memory space referred to by dest and SRC cannot overlap, and dest should have enough space to accommodate the string to be copied.
Return value returns the start address of the dest string.
"Instance" connection string and output.
Plain text Copy
- #include <stdio.h>
- #include <string.h>
- int main ()
- {
- Char str[n];
- strcpy (str,"these");
- strcat (str,"strings");
- strcat (str,"is");
- strcat (str,"concatenated.") );
- Puts (str);
- return 0;
- }
Output Result:
These strings is concatenated.
C language strcat () function: Connection string