HI,
I'm trying to create a dynamic array in one function and then passing it to another function. However I am not able to get it to work ? can someone please tell me how to do this properly ?
Heres my code -
Code:void CreateCars() { Cars* cars = new SportsCar[50]; for(int i = 0; i < 50; ++i) cars[i].SetSpeed(rand()%100); carHandler = new CarHandler(cars,50); }
Can someone tell me how to do this properly ?Code:CarHandler::CarHandler(Car* car_array,int numCars) { this->car_array = car_array; this->numCars = numCars; }
Thank you!



LinkBack URL
About LinkBacks



