fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. int main(void)
  6. {
  7. char *target;
  8. const char *src;
  9.  
  10. src = "Test"; /* point to a static string literal */
  11. target = malloc(strlen(src)+1); /* allocate space for the copy of the string */
  12. if (target != NULL)
  13. {
  14. strcpy(target, src);
  15. printf("%c\n", target);
  16. free(target);
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 2140KB
stdin
Standard input is empty
stdout