strcat() Append a String
#include <string.h> Required for declarations only
char *strcat(string1,string2);
char *string1; Destination string
char *string2; Source string
strcat() appends 'string2' to the end of 'string1'. 'string1' is
terminated with a null character ('\0'). 'string1' has to be large
enough to accommodate 'string2'.
Returns: A pointer to 'string1'.
Notes: strcat() expects to operate on null-terminated strings.
No overflow checking is done when strings are copied or
appended.
-------------------------------- Example ---------------------------------
This example appends the string 'Monday.' to the string 'Today is '.
#include <string.h>
#include <stdio.h> /* for printf */
char str1[25] = "Today is ";
char str2[25] = "Monday."
main()
{
strcat(str1,str2);
printf(str1);
}
Output:
"Today is Monday."
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster