Vprento

Вметнување на еден стринг во друг

Dec 11th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4.  
  5. void concatenateStrings(char *s, char *k, int p)
  6. {
  7.     strcat(k,s+p);
  8.     s[p]='\0';
  9.     strcat(s,k);
  10.  
  11. }
  12.  
  13. int main()
  14. {
  15.     char s[100], k[100];
  16.     int p;
  17.     gets(s);
  18.     gets(k);
  19.     scanf("%d", &p);
  20.     concatenateStrings(s, k, p);
  21.     puts(s);
  22.     return 0;
  23. }
Add Comment
Please, Sign In to add comment