Help with code please!
View Single Post
Your code crashes becoz of line ..
car * car_array = new car[(car_num - 1)];
Say for example..
In your case memory will be allocated only for 3 objects.Hence the program crashes.
Modify it as
car * car_array = new car[(car_num )];