fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void alloc(char **p)
  5. {
  6. *p=(char*)malloc(sizeof(char)*3);
  7. (*p)[0]='a';
  8. (*p)[1]='f';
  9. (*p)[2]='\0';
  10.  
  11. }
  12. int main()
  13. {
  14. char *p="hrrgr";
  15. alloc(&p);
  16.  
  17. printf("%s\n",p);
  18. return 0;
  19. }
Success #stdin #stdout 0s 2424KB
stdin
Standard input is empty
stdout
af