I was trying to make a tree in c++ and came across this code which is really confusing me.
struct node
{
int data;
struct node* left;
struct node* right;
};
// The code bellow this is the part i dont understand
struct node* newNode(int idata)
{
node* node = new struct node;
node->data = idata;
node->left = NULL;
node->right = NULL;
return node;
}
what is struct node*
? Some kind of a structure, but a pointer? Also shouldn't structs have ;
at the end? For example, node
has ;
at the end of the body but not node*
?