fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. void func(char* tokens[10])
  6. {
  7. char* word = malloc( 10 );
  8. strcpy( word, "Hello!" );
  9. tokens[0] = word;
  10. }
  11.  
  12. int main()
  13. {
  14. char* tokens[10];
  15.  
  16. func(tokens);
  17. printf("%s", tokens[0]);
  18.  
  19. free( tokens[0] );
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 4256KB
stdin
Standard input is empty
stdout
Hello!