+ 1
How to use C++ style Arrays?
Why can't the following example compile.. int x; cin>>x; std::array<int,x>{}; Why doesn't it except x??How can i make it work..??
4 Answers
+ 5
You should make it constant
#include <iostream>
#include <array>
using namespace std;
int main() {
const int x=5;
array<int,x> check{1,2,3,4,5};
return 0;
}
+ 2
Can you show the code?
+ 2
ShortCode thanks..
+ 1