我该怎么才能声明一个结构体数组呢?用1的这种方式哪里错了呢?
应该如何声明定义
struct ROLE
{
string id;
int exp;
};
count=count/2;
//1.struct ROLE role=new ROLE[count]
我该怎么才能声明一个结构体数组呢?用1的这种方式哪里错了呢?
应该如何声明定义
struct ROLE
{
string id;
int exp;
};
count=count/2;
//1.struct ROLE role=new ROLE[count]
申明结构体数组,两种方式
struct ROLE role[count] 或者
struct ROLE *pRole = new struct ROLE[count];
你的方法是第二种,但你没有叫星号,所以不对