Skip to content

[c] struct forward declaration in header

Myungchul Shin edited this page Dec 14, 2016 · 2 revisions
1. header1.h in library
typedef struct ac_obj {
...
} ac_obj_t;

2. header2.h
// forward declaration
struct ac_obj;
...
typedef struct res {
    struct ac_obj* aho;
} res_t;
...
void func(struct ac_obj* aho);

3. code2.c
void func(ac_obj_t* aho) {
...
}
Clone this wiki locally