I need to do something like this:
typedef struct a A;
typedef struct b B;
struct a{
B oi;
};
struct b{
A ola;
};
But it returns this error when I try to compile:
gustavo@depaula-ubuntu:~/Desktop/grafo$ gcc test.c
test.c:3:12: error: field ‘ola’ has incomplete type
struct a ola;
^
EDIT: I don't think this is a XY problem, but I need the above code for this (it's not working):
typedef struct union util;
typedef struct graph Graph;
typedef struct vertex_struct Vertex;
typedef struct arc_struct Arc;
typedef struct graph{
Vertex * vertices;
} Graph;
typedef struct vertex_struct {
struct arc_struct * arcs;
int name;
struct util u, v, w, x, y, z;
};
typedef struct arc_struct {
struct vertex_struct * tip;
struct arc_struct * next;
struct util a, b;
};
struct union {
struct vertex_struct * V;
struct arc_struct * A;
struct graph_struct * G;
char * S;
int I;
};