Advertisement
fahamidur

string concatination

Dec 5th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char s1[100], s2[100], i, j;
  5.         printf("Enter first string: ");
  6.         gets(s1);
  7.         printf("Enter second string: ");
  8.         gets(s2);
  9.  
  10.         for(i = 0; s1[i] != '\0'; ++i);
  11.         for(j = 0; s2[j] != '\0'; ++j, ++i)
  12.         {
  13.             s1[i] = s2[j];
  14.         }
  15.         s1[i] = '\0';
  16.         puts(s1);
  17.         return 0;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement