EDIT:
I've changed my struct to match what's in the video as thus in my header file:
typedef struct{
bool end;
struct node* child[27];
}node;
And in my C file when I do:
if(trav->child[cIndex]!=0){
printf("Child node is empty\n");
trav->child[cIndex] = trav;
I get:
dictionary.c:84:41: error: incompatible pointer types assigning to 'struct node *'
from 'node *' [-Werror,-Wincompatible-pointer-types]
trav->child[cIndex] = trav;
Node* trav is malloced properly just liket he root node. Why is the compiler thinking one's a "node*" and the other is "struct node*"?
Also, how do you initialize the values of a node? I did:
node* root;
root = malloc(sizeof(node));
root = 0;
Which, I hope initializes the boolean and the elements of the child node array to 0. Is this a correct assumption to make?
-----------END EDIT----------------
I am using the trie method and have the usual typedef here:
typedef struct{
bool end;
struct node* child[27];
}node;
But when I do
struct node* root;
root = (struct node *) malloc(sizeof(node));
root->end = false;
I am getting:
dictionary.c:47:9: error: incomplete definition of type 'struct node'
root->end = false;
Any ideas would be appreciated.