全局变量的用法

<iframe align="center" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog336280.html" frameborder="0" width="336" scrolling="no" height="280"></iframe>
三个文件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

}


你可能感兴趣的:(全局变量)