I am try to build a basic linked list in C. I seem to get an error for this code:
typedef struct
{
char letter;
int number;
list_t *next;
}list_t
When you are using list_t *next
in your code, the compiler doesn't know what to do with list_t
, as you haven't declared it yet. Try this:
typedef struct list {
char letter;
int number;
struct list *next;
} list;
As H2CO3 pointed out in the comments, using _t
as an identifier suffix is not a great idea, so don't use list_t
.