Home >>C String functions >C strncat() function
C Strncat() function is used to concatenate portion of one string at the end of another string.
Syntax:Strcat(str2,str1,4)
Note:- Here first 4 characters of str1 is append at the end of str2.
It takes 2 strings as parameter.
It returns modified string.
Example-1
#include <stdio.h>
#include <string.h>
int main( )
{
char source[ ] = " helloc" ;
char target[ ]= "C function" ;
printf ( "\nSource string = %s", source ) ;
printf ( "\nTarget string = %s", target ) ;
strncat ( target, source, 5 ) ;
printf ( "\nTarget string after strncat( ) = %s", target ) ;
}