看看呗
http://topic.csdn.net/u/20120614/12/563807c8-d48f-49ad-9ee3-63e8e628252f.html
struct sname
{
int a;
string b;
};
class c
{
sname d[100];
}
请问最终这个数组 d 是建在堆上 还是栈上了?
我的回复:
c obj1;//栈分配
c *obj2=new c;//堆分配
其他人的回复:
栈分配
[解决办法]
其实楼主说的不准确。请问:string b;会再什么地方申请内存??肯定是有堆空间的