typedef struct {
//
} list;
vs
typedef struct list{
//
} list;
I have read in another posts (such as Using an anonymous struct vs a named struct with typedef) which says these two are almost equivalent and the only time when the later is required is when referencing the struct in itself.
However, the following compiles fine with clang and gcc:
#include <stdio.h>
typedef struct {
struct list *next;
} list;
int main(){
list l;
return 0;
}
Above I have an anonymous struct referring to itself. How is this compiling?