c++中变量有三个阶段:声明、定义和初始化。https://www.runoob.com/cplusplus/cpp-variable-types.html
#include <iostream>
using namespace std;
// 变量声明
extern int a, b;
extern int c;
extern float f;
int main ()
{
// 变量定义
int a, b;
int c;
float f;
// 实际初始化
a = 10;
b = 20;
c = a + b;
cout << c << endl ;
f = 70.0/3.0;
cout << f << endl ;
return 0;
}
博客介绍了C++中变量存在声明、定义和初始化三个阶段,并给出了相关参考链接https://www.runoob.com/cplusplus/cpp-variable-types.html 。
872

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



