fork download
  1. # include <stdio.h>
  2.  
  3. void myStrcat(char s[], char t[]){
  4. char *ps = s;
  5. char *pt = t;
  6.  
  7. while(*ps != '\0'){
  8. ps++;
  9. }
  10.  
  11. while(*pt != '\0'){
  12. *ps = *pt;
  13. ps++;
  14. pt++;
  15. }
  16.  
  17. *ps = '\0';
  18. }
  19.  
  20. int main(){
  21. char s[100];
  22. char t[100];
  23.  
  24. scanf("%s %s", s, t);
  25. printf("%s + %s", s, t);
  26.  
  27. myStrcat(s, t);
  28.  
  29. printf(" -> %s\n", s);
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.01s 5272KB
stdin
abc def
stdout
abc + def -> abcdef