I'm getting the error passing argument 1 of ‘add_to_polynomial’ from incompatible pointer type but, I'm pretty sure I'm not. But I'm pretty new to C, this is for an assignment.
The Header, polynomial.h
#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
typedef struct {
void * data;
struct poly_t* next;
} poly_t;
void add_to_polynomial(poly_t * poly, const term_t * term);
#endif
This is inside of a different file - polynomial.c
void add_to_polynomial(poly_t* poly, const term_t* term)
{
if(poly->next != NULL)
{ add_to_polynomial(poly->next, term); }
}
I've tried all sorts of stuff, over the past few days but I finally gave up and came here. It's saying that poly->next is an incompatible pointer type... but it's a pointer to another instance of itself, so how is this not working? Which is all the error means right? It thinks that poly->next isn't a poly_t? also how come struct poly_t*
is different from poly_t*
aren't they the same thing?
First time ever asking a question on here, sorry if I'm not providing enough info or something in advance.