Here is my struct,
typedef struct radixNode *radixPtr;
struct radixNode{
int permission;
int end;
fileType type;
radixPtr link[ASCII_SIZE];
};
I'm allocating memory for radixPtr,
radixPtr q;
q= createRadixNode();
And when I try to do this
q->link[index] = createRadixNode;
gcc gives warning: assignment from incompatible pointer type in c
Here is the allocate memory function
radixPtr createRadixNode () {
radixPtr radix_node = (radixPtr)malloc(sizeof(struct radixNode));
int i;
if(radix_node == NULL) {
perror("There is no memory to create radix node");
exit(1);
}
radix_node->end = -1;
for (i = 0; i < ASCII_SIZE; ++i) {
radix_node->link[i] = NULL;
}
return radix_node;
}
I can't find a way to solve this. All things looks good. Thanks for any advice.