Strcat() function in C – Concatenate strings

The strcat() function is used for string concatenation in C programming language. It means it joins the two strings together. Its syntax is as follows –


String1 and string2 are character arrays. It concatenates (joins) second string at the end of the first string. It does so by removing the null character at the end of the string1 and placing string2 from there. The string at string2 remains unchanged. For example, consider the following two strings –

Also we must make sure that the size of the string1 to which the string2 is concatenated is large enough to accommodate the final string.
C strcat() function may also append a string constant to a string variable. The following is valid:


It is also permitted nesting of strcat functions in c programming. For example the statement –


is allowed and concatenates all the three strings together. The resultant string is stored in string1.

Sample C strcat( ) program to concatenate two strings –


Input –
Enter first string – Study
Enter another string – Street

Output –
Concatenated string – Study Street

yashan has written 69 articles

One thought on “Strcat() function in C – Concatenate strings

  1. merinfo says:

    We are just commenting to let you know what an excellent discovery this cousin’s girl found going through your online web site. She noticed several particulars, such as how it is want to possess an ideal coaching heart to let some others smoothly learn several intense subject matter. You actually did over visitors’ wishes. Thank you for circulating these great, trustworthy, informative and unique advice on that subject in order to Tanya.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>