`
javatgo
  • 浏览: 1123964 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

全局变量的用法

 
阅读更多
三个文件pc_main.h,modpc_com.h,modpc_com.cpp

modpc_com.h中的内容
extern char com_file_name[30];//for comminication
extern int g_mqid;//it is the message queue id


modpc_com.cpp中的内容
#include "modpc_com.h"
int g_mqid=5;
char com_file_name[30]="shared_file";

pc_main.cpp中的内容
#include "modpc_com.h"
int main()
{
cout<<g_mqid<<endl;


}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics