#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int m = 5;
typedef struct node{
char data;
struct node** child[m];
int child_count;
}t;
t tb = {'b'},tc={'c'},td={'d'},tf={'f'},th={'h'},tz={'z'},ty={'y'};
t *t5,*t6,*ta;
void int6(){
t6=(t*)malloc(sizeof(t));
t6->data='g';
t6->child = (t**)malloc(2 * sizeof(t*));
t6->child_count = 2;
t6->child[0]=&tz;
t6->child[1]=&ty;
}
void int5(){
t5 = (t*)malloc(sizeof(t));
t5->data='e';
t5 = (t**)malloc(3 * sizeof(t));
t5->child_count = 3;
t5->child[0]=&tf;
t5->child[1]=&th;
t5->child[2]=t6;
}
void init(){
ta=(t*)malloc(sizeof(t));
ta -> data='a';
ta=(t**)malloc(5 * sizeof(t));
ta->child_count = 5;
ta -> child[0]=&tb;
ta -> child[1]=&tc;
ta -> child[2]=&td;
ta -> child[3]=t5;
ta -> child[4]=t6;
printf("%c\n", ta -> child[4] -> data);
printf("%c\n", ta -> child[4] -> child[0] -> data);
printf("%c\n", ta -> child[4] -> child[1] -> data);
}
void get(t *ts){
int i=0,m1;
if(ts == null){
return;
}
printf("%c\n",ts -> data);
for (i = 0; i < ts->child_count; i++) {
printf("%d\n", i);
get(ts->child[i]);
}
}
void freeTree(Node* root) {
if (root == NULL)
return;
for (int i = 0; i < root->child_count; i++) {
freeTree(root->child[i]);
}
free(root->child);
free(root);
}
int main(int argc, const char * argv[]) {
int5();
int6();
init();
get(ta);
printf("Hello, World!\n");
freeTree(ta);
return 0;
}