fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. char* StringCopy(char* src);
  7.  
  8. int main(void)
  9. {
  10. char* dst = StringCopy("Hello");
  11.  
  12. printf("%s", dst);
  13.  
  14. free(dst);
  15.  
  16. }
  17.  
  18. char* StringCopy(char* src)
  19. {
  20. char*dst = malloc(sizeof(char) * 10);
  21. strcpy(dst, src);
  22.  
  23. return dst;
  24.  
  25.  
  26.  
  27. }
Success #stdin #stdout 0s 5328KB
stdin
Standard input is empty
stdout
Hello