struct node *
is a pointer type. To access its values, you need to dereference them. The following shows what you may have been going for:
typedef struct node_t{
char* word;
int count;
struct node_t* leftchild;
struct node_t* rightchild;
} node;
int main(void){
node *rootnode = (node*)malloc(sizeof(node));
//scanf("%s ", rootnode.word);
//rootnode.count = countchars(rootnode.word);/*haven't written this func yet*/
rootnode->leftchild = (node*)malloc(sizeof(node));
node* leftchild = rootnode->leftchild;
leftchild->word = NULL;
rootnode->rightchild = (node*)malloc(sizeof(node));
node* rightchild = rootnode->rightchild;
rightchild->word = NULL;
return 0;
}
Note that the scanf
line is commented - you need to allocate space for the word buffer before you can read into it. I leave that as an exercise to you :)