fork(1) download
  1. #include <cstring>
  2. #include <iostream>
  3.  
  4. char *str_cat(char *destination, const char *source) {
  5. size_t dest_len = strlen(destination);
  6. memcpy(destination + dest_len, source, strlen(source) + 1);
  7. return destination;
  8. }
  9.  
  10. int main() {
  11. char str[80] = {"these "};
  12. str_cat(str, "strings ");
  13. str_cat(str, "are ");
  14. str_cat(str, "concatenated.");
  15. std::cout << str << std::endl;
  16. }
  17.  
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
these strings are concatenated.