A type may be incomplete if its name is declared, but not its definition. This happens when you forward an ad to a header file.
Let's say record.h contains:
struct record_t; void process_record(struct record_t *r);
And the .c entry contains:
struct record_t { int data; };
If in another module, say, "usage.c", you do this:
#include "record.h" const int rec_size = sizeof(struct record_t);
The record_t
type is incomplete inside the compilation block "usage.c", because it knows only the name of record_t
, and not what this type consists of.
source share