fork download
  1. #include <stdio.h>
  2.  
  3. void test(int x) {
  4. if (x == "open")
  5. printf("opened\n");
  6. if (x == "close")
  7. printf("closed\n");
  8. }
  9.  
  10. int main() {
  11. char *x = malloc(20);
  12. const char *y = x;
  13.  
  14. memset(x, 0, 20);
  15. strcpy(x, "open");
  16.  
  17. test(y);
  18.  
  19. strcpy(x, "close");
  20.  
  21. test(y);
  22.  
  23. free(x);
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 1804KB
stdin
Standard input is empty
stdout
Standard output is empty