Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

strncat - concatenate two substrings

&pagelevel(4)&pagelevel

Syntax

#include <string.h>

char *strncat(char *s1, const char *s2, size_t n);

Description

strncat() appends a maximum of n characters from string s2 to the end of string s1 and
returns a pointer to s1.

The null byte (\0) at the end of string s1 is overwritten by the first character of string s2.

If string s2 contains less than n characters, only the characters from s2 are appended to s1.
If string s2 contains more than n characters, only the first n characters from s2 are appended
to s1.

strncat() terminates the string with a null byte (\0).

Return val.

Notes

Pointer to the result string s1.

Strings terminated with the null byte (\0) are expected as arguments.

strncat() does not verify whether s1 has enough space to accommodate the result!
The behavior is undefined if memory areas overlap.

See also

strcat(), string.h.