'C lang Syntax Error missing ";" before "*"
The error appears in the List* next line.
typedef struct {
List* next;
int data;
int index;
} List;
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | hyde |
