请看下面的代码
Vehicle ** damagedVehicles(Vehicle **vehicles, int size)
{
Vehicle **damaged = new Vehicle *[size];
for(int i=0;i<size;i++)
{
int d = vehicles[i]->damage;
if(d>=35)
{
damaged[i] = vehicles[i];
}
}
return damaged;
}
int main()
{
Vehicle **damagedVehicles = damagedVehicles(vManager->getList(), vManager->getCount());
}
如您所见,我的主要尝试不起作用。如何将该指针数组分配给变量?