帮看看
#include <string>
#include <iostream>
using namespace std;
typedef struct _t
{
int num;
char * aa;
}t;
t* pM;
void test(int n)
{
pM[n].aa = new char[50];
strcpy(pM[n].aa,"test");
pM[n].num=1;
//cout << pM[n].aa;
}
int main()
{
pM=new t;
for (int i=0;i<100;i++)
{
test(i);
}
for (int n=0;n<100;n++)
{
delete pM[n].aa;
}
delete []pM;
return 0;
}
[解决办法]
pM=new t[100]; //这样就OK,不然分配的空间太少了
[解决办法]
delete []pM;
==========>delete pm
[解决办法]