我试图弄清楚前向声明是如何相互作用的。当前向声明一个接受typedef结构体的函数时,是否有办法让编译器仅将以前前向声明(但实际上未定义)的结构体作为参数接受?
我已经得到了工作代码:
typedef struct{
int year;
char make[STR_SIZE];
char model[STR_SIZE];
char color[STR_SIZE];
float engineSize;
}automobileType;
void printCarDeets(automobileType *);
我希望能做到的:
struct automobileType;
void printCarDeets(automobileType *);
//Defining both the struct (with typedef) and the function later
我觉得我可能要么缺少一些非常基础的知识,要么不理解编译器如何处理结构体的前向声明。