fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. void helper(char **a, const char *b){
  6. *a = malloc(strlen(b)+1);
  7. strcpy(*a, b);
  8. printf("%s %s\n", *a, b);
  9. }
  10.  
  11. int main(void){
  12. const char *b = "hello";
  13. char *a;
  14. helper(&a, b);
  15. printf("%s\n", a);
  16. free(a);
  17. }
Success #stdin #stdout 0s 2300KB
stdin
Standard input is empty
stdout
hello hello
hello