C Reference String Operation: strcat()

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

Usage:

char * strcat ( char * destination, const char * source );

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

strcat() source code example:


	#include<stdio.h>
	#include<string.h>

	int main ()
	{
		char str[80];
		strcpy (str,"one");
		strcat (str,"two");
		puts (str);
		return 0;
	}

Output of the strcat example:


	onetwo

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: