here is the code i've written
#include "tree.h"
BTREE new_node(void)
{
return(malloc(sizeof(NODE)));
}
BTREE init_node(DATA d1, BTREE p1, BTREE p2)
{
BTREE t;
t = new_node();
t -> d = d1;
t -> left = p1;
t -> right = p2;
return t;
}
BTREE create_tree(DATA a[], int i, int size)
{
if(i >=size)
{
return NULL;
}
else
{
return(init_node(a, create_tree(a, 2 * i + 1, size),
create_tree(a, 2 * i + 2, size)));
}
}
main(){}
//////////////////////////////////////////////////////
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef char DATA;
struct node{
DATA d;
struct node *left;
struct node *right;
};
typedef struct node NODE;
typedef NODE *BTREE;
I'm completely new to C and i want to add string variables to the node struture but i cant seem to make anything work.
Any suggestions?
Paul