I am using a linked list defined as follows:
typedef struct {
    struct foo* next;
} foo;
Assuming that it has already been set up with the head pointer called linked_list and I want to iterate through the linked list as follows:
foo* curr = linked_list;
while(curr->next) {
    curr = curr->next;
}
My compiler (Clang) throws a warning about converting from struct foo* to foo* [-Wincompatible-pointer-types]
I know that I can suppress this warning by casting it, but is there a better way of doing this?
 
    