I am not understanding why the following code is not working. I am assuming the problem is in the InsertNode function.

Code:

#include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int value;
struct Node* left;
struct Node* right;
} Node;
Node* InitNode(int value);
void InsertNode(Node* node, Node* newnode);
void PrintTree(Node* node);
Node* InitNode(int value)
{
Node* node = (Node*)malloc(sizeof(Node));
node->value = value;
node->left = NULL;
node->right = NULL;
return(node);
}
void InsertNode(Node* node, Node* newnode)
{
if (node == NULL)
{
node = newnode;
return;
}
if (newnode->value < node->value)
InsertNode(node->left, newnode);
else
InsertNode(node->right, newnode);
}
void PrintTree(Node* node)
{
if (node == NULL)
return;
PrintTree(node->left);
printf(" %3d", node->value);
PrintTree(node->right);
}
int main()
{
Node* root = InitNode(5);
Node* left = InitNode(4);
Node* right = InitNode(6);
InsertNode(root, left);
InsertNode(root, right);
PrintTree(root);
return(0);
}