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