-1

请看下面的代码

    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());
}

如您所见,我的主要尝试不起作用。如何将该指针数组分配给变量?

4

1 回答 1

2

重命名变量,使其不与函数名称冲突?

Vehicle **myDamagedVehicles = damagedVehicles(vManager->getList(), vManager->getCount());
于 2012-12-21T08:27:27.267 回答