//初识常见关键字)(2)
//关键字static 可以修饰局部变量 全局变量 函数
#include <stdio.h>
void test()
{
int a = 1;
a++;
printf("%d", a);
}
int main()
{
int i = 0;
while (i < 10);
{
test();
i++;
}
return 0;
}//结果十个2
//static修饰局部变量,改变了局部变量的生命周期
//本质上改变了变量的存储类型)
#define_CRT_SEVER_NO_WARNINGS; //声明extern
int g_val = 2022;//extern int g_val;
//printf("%d\n",g_val);
//return 0;
//static修饰全局变量使用的这个全局变量只能在源文件(.c)使用
//不能在其他文件使用
//全局变量在其他源文件内部可以使用是因为全局变量具有外部链接属性
//但是在static修饰之后就变成了内部链接属性其他源文件无法链接