Every time I try to compile my program i get the error: error C2440: 'initializing' : cannot convert from 'void *' to 'node *'
To be honest I dont understand the error and i have changed the line a few times to fix it but to no avail
The code containing the line and the struct declarisation is below:
Code:
#include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
struct node *CTaxi_addTaxi(struct node **p, int i)
{
struct node *n = malloc(sizeof(struct node)); //ERROR ON THIS LINE!
if (n == NULL)
return NULL;
n->next = *p;
*p = n;
n->data = i;
return *p;
}
Thanks for any help given