YouTip LogoYouTip

C Examples Concatenate String

# C Example - Concatenating Strings [![Image 1: C Examples](#) C Examples](#) Use strcat() to concatenate two strings. ## Example #includeint main(){char s1, s2, i, j; printf("Enter the first string: "); scanf("%s", s1); printf("Enter the second string: "); scanf("%s", s2); // Calculate the length of string s1 for(i = 0; s1 != ''; ++i); for(j = 0; s2 != ''; ++j, ++i){s1 = s2; }s1 = ''; printf("After concatenation: %s", s1); return 0; } The output is: Enter the first string: google Enter the second string: After concatenation: googletutorial [![Image 2: C Examples](#) C Examples](#)
← C Examples Complex Number AddC Examples Frequency Character β†’