[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
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."

See Also: strncat()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson