C – Strncat

C – Strncat 2017-06-12T11:13:31+00:00

strncat()

Syntax :
#include<string.h>
char *strncat( char *str1, const char *str2,size_t count  );

strncat(str1,str2,n) concatenates not more than n characters  of the string pointed to by str2 to the the string pointed to by str1 and terminates str1 with a null. The first character of str2 overwrites the null terminator originally ending sr1. The str2 is untouched by the operation.

Example :

Output :

Before concatenation :

str1: www.learner

str2:mode.com

After concatenation :

str1: www.leranermode

str2:mode.com

 

Prev Next