fork(2) download
  1. #include <stdio.h>
  2.  
  3. typedef struct mia {
  4. int a;
  5. }hola;
  6.  
  7. typedef struct m {
  8. hola **r;
  9. }bic;
  10.  
  11. int main(void) {
  12. bic y;
  13. y.r = malloc(sizeof(hola*));
  14. *y.r = malloc(sizeof(hola));
  15. // You need an extra level of dereference (i.e. an asterisk)
  16. scanf("%d", &((*y.r)->a));
  17. printf("%d", ((*y.r)->a));
  18. free(*y.r);
  19. free(y.r);
  20. return 0;
  21. }
Success #stdin #stdout 0s 1968KB
stdin
12345
stdout
12345