Advertisement
Guest User

concatenate

a guest
Dec 7th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. #include<string.h>
  4.  
  5.  
  6.  
  7. int main()
  8.  
  9. {
  10.  
  11.   char str1[50]="My name is ";
  12.  
  13.   char str2[50]="Sadia Afrin Reme";
  14.  
  15.   int i=0,len=0,j=0;
  16.  
  17.   while(str1[i]!='\0')
  18.  
  19.   {
  20.  
  21.     i++;
  22.  
  23.     len++;
  24.  
  25.   }
  26.  
  27.   while(str2[j]!='\0')
  28.  
  29.   {
  30.  
  31.     str1[len+j]=str2[j];
  32.  
  33.     j++;
  34.  
  35.   }
  36.  
  37.    printf("str1 = %s\n",str1);
  38.  
  39.    return 0;
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement