Strncat in c

strncat() is used to merge two strings .the first character of the second string overwrites the null character of first string

syntax:

strncat (s1,s2,n)

here we can choose the size of the merged string using n .while printing out the merged string we should choose the first part, as in example s1 is used for printf()

example:

#include
#include
#include
int main()
{
char s1[30]="codeskulls";
char s2[30]="website";
printf("Before merging :");
printf("\n str1 : %s \n str2: %s \n\n",s1,s2);
strncat(s1,s2,15);
printf( "\nTarget string after strcat( ) = %s",s1);
}