- strncat( ) function in C language concatenates ( appends ) portion of one string at the end of another string. Syntax for strncat( ) function is given below.
char * strncat ( char * destination, const char * source, size_t num );
- Example :
strncat ( str2, str1, 3 ); – First 3 characters of str1 is concatenated at the end of str2.
strncat ( str1, str2, 3 ); – First 3 characters of str2 is concatenated at the end of str1.
- As you know, each string in C is ended up with null character (‘