fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. char *hoge;
  7.  
  8. hoge = malloc(100);
  9. // if (hoge == NULL) {
  10. if (!hoge) {
  11. printf("error\n");
  12. exit(1);
  13. }
  14. strcpy(hoge, "hello, world\n");
  15. printf(hoge);
  16. free(hoge);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.01s 1852KB
stdin
Standard input is empty
stdout
hello, world