i'm trying to implement tree structure in c:
this part is from the header file:
typedef struct SP_Tree_Node
{
char * value;
struct Node * children;
int indexOfLastChild;
} Node;
typedef struct SP_Tree
{
Node root;
} Tree;
when i'm trying to insert new Node into children array the next error appears: "dereferencing pointer to incomplete type" this is the code: (tree's type is Tree *)
Node * newNode = (Node*) malloc(sizeof(Node*));
tree->root.children[tree->root.indexOfLastChild] = newNode;
what am i doing wrong? thank you!!