C Programming Code Examples C > Strings Code Examples Program to Concat Two Strings without Using Library Function Program to Concat Two Strings without Using Library Function In this C Program we have to accept two strings from user using gets and we have to concatenate these two strings without using library functions. Inside the concate() function we are firstly calculating the size of first string. Now we are iterating 2nd string character by character and putting each character to the end of the 1st string. #include<stdio.h> #include<string.h> void concat(char[], char[]); int main() { char s1[100], s2[40]; printf("\nEnter String 1 :"); gets(s1); printf("\nEnter String 2 :"); gets(s2); concat(s1, s2); printf("nConcated string is :%s", s1); return (0); } void concat(char s1[], char s2[]) { int x, j; x = strlen(s1); for (j = 0; s2[j] != '\0'; x++, j++) { s1[x] = s2[j]; } s1[x] = '\0'; }