fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. /// fill class in any way
  5. class Vehicle
  6. {
  7. public:
  8. int internal_value;
  9. };
  10.  
  11. int main() {
  12. // your n count
  13. unsigned int n = 5;
  14. // declare your array pointer and alloc memory for it
  15. Vehicle* myVehicleArray = new Vehicle[ n ];
  16.  
  17. // use it in some way
  18. for( unsigned int i = 0; i < 5; ++i )
  19. {
  20. myVehicleArray[i].internal_value = i;
  21. }
  22. // free memory
  23. delete [] myVehicleArray;
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 3268KB
stdin
Standard input is empty
stdout
Standard output is empty