I have a struct defined as follows:
Supposedly the typedef name (in this case "node") can't be referenced in the struct itself, so the struct name (t_node) is used instead. But the idea is that the t_nodes child and parent will be addressed as "node" elsewhere, right?
So I make the following:
Why does line 3 work then, but not 4? And how would one resolve 4?
Code:
typedef struct t_node
{
struct t_node* child;
struct t_node* parent;
} node;
So I make the following:
Code:
1. node* root = (node*) malloc (sizeof (node)); 2. node* leaf = (node*) malloc (sizeof (node)); 3. n->parent = r; // No complaints here 4. r->children[i] = n; // Compilation error C2679: binary '=' : no operator found which takes a right-hand operand of type 'node *' (or there is no acceptable conversion) ... while trying to match the argument list '(node, node *)'
Comment