Append string: strncat : String Append « String « C / ANSI-C






Append string: strncat

Append string: strncat

#include <stdio.h>
#include <string.h>

int main(void)
{
  char s1[80], s2[80];
  unsigned int len;

  gets(s1);
  gets(s2);

  len = 79 - strlen(s2);

  strncat(s2, s1, len);
  printf(s2);

  return 0;
}

           
       








Related examples in the same category

1.Demonstrates how to put strings together using strcat
2.Get first and last name and print them together
3.Join strings
4.Join strings: revitalised: strlen and strcat
5.Append string to another string
6.String concatenate
7. Append substring to string: strncat
8. Append string: how to use strcat Append string: how to use strcat