C Reference String Operation: strncat()

The strncat() function concatenates up to n characters of one string onto the end of another string.


char *strncat(char *target, const char * source, size_t count);

Note: null character is added add the end. The target is returned by strncat() function.

strncat() source code example:


		char line[100];
		strcpy(line, "hello");

		strncat(line, "world",2);
		printf ("%s\n",line);

Output of the example:


This entry was posted in C Reference string.h Functions. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

Leave a Reply: