0

How do I use malloc to allocate memory for use in a trie data structure given:

typedef struct node
{
    bool in_word;
    struct node* children[27];
}
LETTERNODE;

What is the syntax for malloc in this case?

LETTERNODE letterptr = (node*) malloc(size_T node); 

????

1 Answer 1

2

For the structure given by node above, memory can be allocated using the following syntax:

LETTERNODE * lettterptr = malloc(sizeof(LETTERNODE)); 

or more universally:

struct node * letterptr = malloc(sizeof(struct node));  

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .