I have a struct
named Node
which has 2 attributes: an int v
and another Node*
named child
. If I do not explicitly provide a constructor for my struct
, what value does child
receive by default?
struct Node
{
int v;
Node * child;
};
It seems that it is not the NULL
pointer, so I had to write a constructor inside my structure
struct Node
{
int v;
Node * child;
// constructor
Node():v(0),child(NULL){}
};