如何在data.h和data.cpp下声明和定义,使得能在meun.cpp中直接引用head?
1条回答 默认 最新
- 小白小白你好菜 2021-02-23 15:12关注
你想在哪个程序调用,就在哪个程序定义extern struct name *head;
同时你在定义结构体的那个程序中定义struct name *head;
extern是外部变量的声明,所以是在哪个使用程序中声明extern
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
你想在哪个程序调用,就在哪个程序定义extern struct name *head;
同时你在定义结构体的那个程序中定义struct name *head;
extern是外部变量的声明,所以是在哪个使用程序中声明extern