Concatenate two strings with C.
#include <stdio.h>
#include <string.h>
int main()
{
char str1[100], str2[100];
/* Input two strings from user */
printf("Enter first string: ");
gets(str1);
printf("Enter second string: ");
gets(str2);
/* Concatenate str1 with str2 */
strcat(str1, str2);
printf("Concatenated string = %s", str1);
return 0;
}
Output
Enter first string: Rezaul
Enter second string: Karim
Concatenated string = RezaulKarim
0 Comments