//学习使用external的用法
#include <stdio.h>
#include <stdio.h>
int a,b,c;
void add()
{
int a;
a=3;//局部变量a在函数中起着作用
c=a+b;
}
main()
{a=b=4;
add();printf("The value of c is equal to %d\n",c);
return 0;
}
void add()
{
int a;
a=3;//局部变量a在函数中起着作用
c=a+b;
}
main()
{a=b=4;
add();printf("The value of c is equal to %d\n",c);
return 0;
}
本文通过一个简单的C语言示例程序介绍了如何使用external变量,并解释了局部变量与全局变量的作用范围区别。通过main函数和add函数之间的交互展示了变量声明与使用的细节。
989

被折叠的 条评论
为什么被折叠?



