So I have the following located in a .h file
typedef struct Supply {
char* name;
struct Supply* nextSupply;
int quantity;
} Supply;
And the following
typedef struct Location {
Supply* firstSupply;
} Location;
And I want to use it in a snippet such as this in a c file where the h file is included
void snippet(Location* location, Supply* incoming) {
Supply* first = location->firstSupply;
Supply* check = first->nextSupply;
if(!strcmp(first->name,incoming->name) {
*some stuff*
}
*while loop checking entire linked list*
}
Why is it that I am told by gcc -Wall -pedantic that I am assigning from invalid pointer types. I understand that in definition of Supply I must refer to the nextSupply as a struct Supply* but I thought after the definition is finished then Supply* == struct Supply*