C Programming Code Examples C > Strings Code Examples Program to concatenate two strings without using strcat Program to concatenate two strings without using strcat In the following program user would be asked to enter two strings and then the program would concatenate them. For concatenation we have not used the standard library function strcat(), instead we have written a logic to append the second string at the end of first string. #include <stdio.h> int main() { char str1[88], str2[88], x, j; printf("\nEnter first string: "); scanf("%s",str1); printf("\nEnter second string: "); scanf("%s",str2); /* This loop is to store the length of str1 in x * It just counts the number of characters in str1 * You can also use strlen instead of this. */ for(x=0; str1[x]!='\0'; ++x); /* This loop would concatenate the string str2 at the end of str1 */ for(j=0; str2[j]!='\0'; ++j, ++x) { str1[x]=str2[j]; } // \0 represents end of string str1[x]='\0'; printf("\nOutput: %s",str1); return 0; }