C++ 在线判断平台中的全局数组堆内存分配
下面是一个最简单的程序:C++ 在线判断平台中的全局数组堆内存分配,c++,arrays,memory-management,C++,Arrays,Memory Management,下面是一个最简单的程序: #include <iostream> using namespace std; char c[1000 * 1000 * 100]; int main() { int a, b; while (cin >> a >> b) { cout << a+b << endl; } return 0; } #包括 使用名称空间std; 字符
#include <iostream>
using namespace std;
char c[1000 * 1000 * 100];
int main() {
int a, b;
while (cin >> a >> b) {
cout << a+b << endl;
}
return 0;
}
#包括
使用名称空间std;
字符c[1000*1000*100];
int main(){
INTA,b;
而(cin>>a>>b){
coutc
未在堆上分配。它存储在中。加载进程时保留数据段。非常感谢您的回答。但我想知道是否立即分配它?