hi, I am pretty new to C.
I am getting this error:
incompatible implicit declaration of built-in function ‘malloc’
Even when I fix the code based on the answers to include stdlib, I still get:
two or more data types in declaration specifiers
When trying to do this:
struct tnode
{
int data;
struct tnode * left;
struct tnode * right;
}
struct tnode * talloc(int data){
struct tnode * newTnode;
newTnode = (struct tnode *) malloc (sizeof(struct tnode));
newTnode -> data = data;
newTnode -> left = NULL;
newTnode -> right = NULL;
return newTnode;
}
How do I fix it?