strcat Function

  • It concatenates a copy of *str2 to *str1 and terminates *str1 with a null .
  • It returns *str1 .


  • Syntax:

      char *strcat(char *str1, const char *str2);

    Example:

    
    
    
    #include <stdio.h>
    
    #include <string.h>
    
    
    
      int main()
    
      {
    
        char s1[80], s2[80];
    
    
    
        printf("s1:");
    
        gets(s1);
    
        printf("s2:");
    
        gets(s2);
    
    
    
        strcat(s2, s1);
    
        printf(s2);
    
    
    
        return 0;
    
      }
    Back