Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1.     char *strcat(char *destination, const char *source) {
  2.         int i = 0, j = 0;
  3.         while (destination[i] != char(0) && source[j] != char(0)) {
  4.             if (destination[i] != char(0)) {
  5.                 i++;
  6.             }
  7.             if (source[j] != char(0)) {
  8.                 j++;
  9.             }
  10.         }
  11.         int t = i + j - 1;
  12.         j = 0;
  13.         while (i != t) {
  14.             destination[i] = source[j];
  15.             i++;
  16.             j++;
  17.         }
  18.         destination[t] = char(0);
  19.         return destination;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement