way, how to add new element to the end of the array?
No, there is no way. Synce it is allocated, the size is fixed. To extend, you must create a new larger one, copy old data and fill new extra elements' places with new data. This what std::vector does automatically, that is why using it instead of raw new int[100] is a great idea.
Обсуждают сегодня