#include <iostream>
#include <array>
using namespace std;
int main(){
int a = [];
int b = 10;
std::fill(a);
cout<<a<<endl;
}
I have an array "a" and want to fill it with an integer "b". As I remember in python its simply uses apppend, does someone know solution?
afirst, or usestd::vector.int a = [];is not valid C++.aas astd:arraywould let you usestd::array::fill()-- en.cppreference.com/w/cpp/container/array/fillstd::filltakes 3 parameters: starting address, one past end, and fill value.