Advertisement
mihainan

Nan Mihai - Tema SD

Apr 19th, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. typedef struct node
  2. {
  3.     char* label;
  4.     struct node* child;
  5.     int num_parents;
  6.     struct node* parents[];
  7. }*Node;
  8.  
  9. typedef struct tree
  10. {
  11.     Node root;
  12.     struct tree* next;
  13. }*Tree;
  14.  
  15. Tree init()
  16. {
  17.     Tree t;
  18.     Node root;
  19.     t = (Tree) malloc(sizeof(struct tree));
  20.     root = (Node) malloc(sizeof(struct node));
  21.     root->label = (char*) malloc(10*sizeof(char));
  22.     root->label = "radacina";
  23.     root->child = NULL;
  24.     root->num_parents = 0;
  25.     t->root = root;
  26.     t->next = NULL;
  27.     return t;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement