I want use a typedef struct that isn’t already defined, but it is later.
Is there anything like a struct prototype?
file container.h
// i would place a sort of struct prototype here
typedef struct
{
TheType * the_type;
} Container;
file thetype.h
typedef struct {......} TheType;
file main.c
#include "container.h"
#include "thetype.h"
...
Replace this line:
with these lines:
Since you need the type
TheTypeto be defined before typeContaineris defined, you have to use forward declaration of typeTheType– and to do so you also need forward declaration of structTheType.Then you will not define typedef
TheTypelike this:but you will define struct
TheType: