Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>strcat() append a string</b> http://www.X-Hacker.org [<<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()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson