关于static和extern
vc6.0下
//main.cpp
#include"f1.h"
#include<stdio.h>
//问题一:static不是用来把全局变量限制在本模块用的吗?为什么main.cpp还能正常使用.已经用static了
extern int a;问题二:extern是用来在模块之间共享变量的,为什么我用了这句,f1.h中去掉static会报连接错误。用的那里有问题?
int main(void)
{
printf("%d\n",++a);
return 0;
}
//f1.h
static int a=9;
难道和ms编译器有关?