strncat Function

  • It concatenates not more than count characters of *str2 to *str1 and terminates str1 with a null .
  • It returns *str1 .


  • Syntax:

      char *strncat(char *str1, const char *str2, size_t count);

    Example:

    
    
    
    
    #include <stdio.h>
    
    #include <string.h>
    
    
    
      int main()
    
      {
    
        char s1[80]="s awesome !", s2[80]="Anuj i";
    
        unsigned int len;
    
    
    
        len = 79-strlen(s2);
    
        strncat(s2, s1, len);
    
        printf(s2);
    
    
    
        return 0;
    
      }
    Back