如何将元素追加到数组 c++

How to append an element to an array c++

本文关键字:数组 c++ 追加 元素      更新时间:2023-10-16

我正在尝试创建一个将整数值添加到数组的 for 循环。我知道在 python 中它就像 x.append(( 一样简单,但我想知道如何将 c++ 中的值附加到数组中?

使用std::vector<T>,并调用v.push_back()

C++中的数组无法更改其大小。