Advertisement
shawonrog

03(Concatenited two strings)

Sep 23rd, 2019
139
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. #include <stdlib.h>
  3.  
  4. int main(){
  5.  
  6.     char a[50],b[50];
  7.     int i=0,k=0;
  8.  
  9.     printf("First String: ");
  10.     gets(a);
  11.     printf("Second String: ");
  12.     gets(b);
  13.  
  14.     while(a[i]!='\0'){
  15.         i++;
  16.     }
  17.  
  18.     while(b[k]!='\0'){
  19.         a[i]=b[k];
  20.         i++;
  21.         k++;
  22.     }
  23.     a[i]='\0';
  24.     printf("\nConcatenated String is: %s\n",a);
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement