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. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

Comments are closed.