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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.