The error appears in the List* next line.
typedef struct {
List* next;
int data;
int index;
} List;
As noted in comments, the type List is not known when you use it. There are two solutions to this.
The first is to simply use struct List *next:
typedef struct List {
int n;
struct List *next;
} List;
The other is to typedef List into existence before defining struct List.
typedef struct List List;
struct List {
int n;
List *next;
};
Which is better is opinion, and thus inappropriate for SO.
Listthat is known to the compiler. You cannot use a type before it is defined. You need to use the struct tag if you want to use that type during the declaration:typedef struct List { struct List *next; ...}You might revisit your learning material that introduces linked lists. It should explain that topic.