This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I would like to define an array as:
int N = 100;
double Xn[N];
However, an error occurs: expression must have a constant value.
If I change the expression as follows:
double Xn[100].
no error occurs.
I don't know the reason.
The upper expression could be compiled in Dev-C++, and is easy to be modified.
Thanks.
PP
If you are compiling in C mode, this can't be made to work without using a #define.
If you are compiling in C++ mode, you need to make it const:
const int N = 100; double Xn[N];