Advertisement
sellmmaahh

spaja dva stringa sa _

Feb 4th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. char *spoji (char* p1, char* p2)
  5. {
  6.     char* s=p1;
  7.     while (*s!='\0')
  8.         s++;
  9.     *s='_';
  10.     s++;
  11.     while (*p2!='\0')
  12.          {*s=*p2;
  13.     s++;
  14.      p2++;
  15. }
  16. *s=*p2;
  17. return p1;
  18. }
  19. int main ()
  20. {
  21.     char string1[10], string2[10];
  22.     printf("unesite 2 rijeci: ");
  23.     scanf("%s %s", string1, string2);
  24.      printf ("%s", spoji(string1, string2));
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement