C Program to Concatenate String

« Previous Program Next Program »

Concatenate String in C

To concatenate or to append one string to another string in C programming, you have to ask to the user to enter the two string and start concatenating one string into other using strcat() function

C Programming Code to Concatenate String

Following C program ask the user to enter the two string to concatenate it using the function strcat() of string.h library. This function takes the two argument like strcat(str1, str2). Here string of str2 will be appended at the end of the string str1 :

/* C Program - Concatenate String */
void main()
	char str1[50], str2[50];
	printf("Enter first string : ");
	printf("Enter second string : ");
	strcat(str1, str2);
	printf("String after concatenation is %s",str1);

When the above c program is compile and executed, it will produce the following result:

c program concatenate two strings

Same Program in Other Programming Language

You may also like same program in other programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test