Relative Content

Tag Archive for carrays

C++ std::array initialisation expecting a “;”

#include <iostream> #include <array> using namespace std; int main(){ array<int,5> a {1,2,3,4,5}; for(int i = 0; i < 5; i++){ cout << a[i] << endl; } return 0; } When I go to compile this, I get this error: error: expected ‘;’ at end of declaration array<int,5> a{1,2,3,4,5}; ^ ; 1 error generated. But I […]