I am making a program that makes a binary search tree with the values from an array of ten integers. When I compile, though, the compiler tells me the line with the call to malloc() "makes initialization pointer from integer without cast." I was wondering what was wrong with the function because I copied it directly from a book.
Code:
#include<stdio.h>
typedef struct node* link;
struct node {
int key;
link l;
link r;
};
static link head, z;
link NEW(int key, link l, link r) {
link x = malloc(sizeof *x);
x->key = key;
x->l = l;
x->r = r;
return x;
}