fork download
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. void func(char* s)
  8. {
  9. s = (char*)malloc(6);
  10. strcpy(s,"World");
  11. //s = "World";
  12. }
  13.  
  14. int main()
  15. {
  16. char str[10] = "Hello";
  17. printf("%s ", str);
  18. func(str);
  19. printf("%s ", str);
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Hello Hello