【发布时间】:2014-02-25 08:40:04
【问题描述】:
我正在使用 Visual Studio 2008 for Windows 编译以下内容。
当我这样声明一个全局数组时:
//.cpp file
// on a global scale
// (i.e. outside any class definition)
MY_ITEM glob_arr[1024];
在哪里
//.h file
extern MY_ITEM glob_arr[1024];
class MyClass
{
public:
MyClass()
{
//Start using glob_arr
glob_arr[0].v = 0;
//...
}
};
和
struct MY_ITEM{
int v;
WCHAR chrs[64];
};
glob_arr 分配在哪里——从堆栈还是进程堆?
【问题讨论】:
标签: c++ c visual-studio heap-memory stack-memory