fork(1) download
  1. #include <stdio.h>
  2.  
  3. typedef struct elem {
  4. void * d;
  5. } Elem;
  6.  
  7. int main() {
  8. Elem *p = &(struct elem) { .d = NULL }; //malloc(sizeof(Elem));
  9. Elem e;
  10.  
  11. double pi = 3.14;
  12. e.d = &pi;
  13. p->d = &pi;
  14.  
  15. printf("%f\n", *((double *)p->d));
  16. printf("%f\n", *((double *)e.d));
  17. return 0;
  18. }
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
3.140000
3.140000