Answer the question
In order to leave comments, you need to log in
Why does this snippet throw an error in Visual Studio?
Situation:
I've been familiar with C++ for a couple of hours.
There is code below. In CLion it works without a hitch, everything is as it should be. The studio, on the other hand, swears like a shoemaker that the rows and columns variables should be (what the heck?) constants. Hence the question: what the hell?!
#include <iostream>
using namespace std;
int main(){
int rows;
int columns;
cout << "Enter number of rows: \n";
cin >> rows;
cout << "Enter number of columns: \n";
cin >> columns;
int field[rows][columns];
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question