Concatenating Two Strings

Learn how to concatenate two strings in C.

The strcat() function

strcat( ) attaches the source string to the end of the target string.

We pass the base addresses of the target and the source strings to strcat(). The basic syntax of the strcat() function is given below:

char* strcat(const char *str2, const char *str1);

The order of passing the base addresses to strcat( ) must always be the target, followed by the source.

Get hands-on with 1200+ tech skills courses.