fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. struct node{
  6. int key;
  7. int data;
  8. struct node *next;
  9. };
  10.  
  11. int main(void) {
  12. struct node *link = (struct node*) malloc(sizeof(struct node));
  13. link->key = 10;
  14. link->data = 100;
  15. link->next = link;
  16. printf("%zd %zd %zd %zd\n", sizeof(link->key), sizeof(link->data), sizeof(link->next), sizeof(*link));
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 2300KB
stdin
Standard input is empty
stdout
4 4 4 12