-2

I am trying to make a for loop that adds an integer value to an array. I know in python it is as simple as x.append() but I want to know how I would append a value in c++ to an array?

1 Answers1

6

Use a std::vector<T>, and call v.push_back().

Arrays in C++ cannot change their size.

aschepler
  • 70,891
  • 9
  • 107
  • 161