typedef struct tree_node
{
    int data;
    struct tree_node *left;
    struct tree_node *right;
}node;
node* newnode(int data)
{
    node *node=(node*)(malloc(sizeof(struct tree_node)));
    node->data=data;
    node->left=NULL;
    node->right=NULL;
    return(node);
}
The code is showing error in this part. What is the error? Why is it not compiling? EDIT: The error shown is error: expected primary-expression before ')' token. However if I change the code to
node* newnode(int data)
{
    node *node1=(node*)(malloc(sizeof(struct tree_node)));
    node1->data=data;
    node1->left=NULL;
    node1->right=NULL;
    return(node1);
}
it works perfectly. What is the reason for this?
 
    