strncat() — Concatenate Strings

Format

#include <string.h>

char *strncat(char * __restrict__string1, 
const char * __restrict__string2, size_t count);

General Description

The strncat() built-in function appends the first count characters of string2 to string1 and ends the resulting string with a NULL character (\0). If count is greater than the length of string2, strncat() appends only the maximum length of string2 to string1. The first character of the appended string overwrites the terminating NULL character of the string pointed to by string1.

If copying takes place between overlapping objects, the behavior is undefined.

Returned Value

The strncat() function returns the value string1, the concatenated string.

Related Information