error: variable length array declaration not allowed at file scope
Double_t x[n], y[n];
Double_t *x = new Double_t[n];
Double_t *y = new Double_t[n];
// ...
delete [] y; // cleanup
delete [] x; // cleanup
C++ does not allow such arrays that way if n can change. If n never changes, you can just declare it as const, i.e.
const Int_t n = 5;
Double_t x[n], y[n];
#include <array>
// ...
std::array<Double_t, n> x, y;
Thank you very much.
It is working.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.