regarding to what hk_mp5kpdw says:

i understood that i should write

my problem is with the start of the signature of this function

my function returns a node pointer so

when i will write

Code:

node insert (node *root,int data);

my function will return node

but i need node pointer

i changed it like you said

it doesnt work

Code:

#include <stdio.h>
typedef struct node{
struct node *left;
struct node *right;
int data;
}node;
node insert (node *root,int data);
int main(){
node * root=NULL;
root=insert(root,2);
root=insert(root,1);
root=insert(root,10);
root=insert(root,5);
return 0;
}
node insert (node *root,int data){
if (!root){
root=malloc(sizeof(node));
root->data=data;
root->right=NULL;
root->left=NULL;
}//end if
else{
if (data<=root->data){ //start if check
root->left=insert(root->left,data);
}//end if check
else {
root->right=insert(root->right,data);
}
}//end else
return root;
}//end insert