fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. struct temp
  5. {
  6. int var1;
  7. };
  8.  
  9. struct temp* doThis()
  10. {
  11. struct temp* x = (struct temp*)malloc(sizeof(struct temp));
  12. x->var1 = 10;
  13. return x;
  14. }
  15.  
  16. void doThat(void* x)
  17. {
  18. struct temp * x2 = (struct temp *) x;
  19. printf("x2->var1 = %d\n", x2->var1);
  20.  
  21. struct temp** x3 = x;
  22. printf("x3->var1 = %d", (*x3)->var1);
  23. }
  24.  
  25. int main()
  26. {
  27. struct temp * x = doThis();
  28. printf("x->var1 = %d\n", x->var1);
  29. doThat(&x);
  30. }
  31.  
Runtime error #stdin #stdout 0s 1964KB
stdin
Standard input is empty
stdout
x->var1 = 10
x2->var1 = 149577736
x3->var1 = 10