Alf P. Steinbach wrote:
* Henrietta Denoue:
double* ydata[21];
And supposing this to be 21 pointers how do I initialize
them to point to null ? Is this wrong:
for i=0; i=20 i++
ydata[i] = NULL;
Yes, that is wrong, both syntactically (it's not C++) and in intent.
I think the intent is correct (if not optimal), this would work too:
for (int i = 0; i != 21; ++i)
ydata[i] = 0;
After allocating new I try this:
for (int i = 0; i < 1000; i++) {
ydata[0][i] = double(rev_data[i]);
At it just crashes.
Compare that loop to the previous ones.
If it crashes then there must be something wrong with rev_data[i],
assuming the OP fixed his syntax errors:
for (int i = 0; i != 21; ++i)
ydata[i] = new double[1000];
for (int i = 0; i != 1000; ++i)
ydata[0][i] = rev_data[i];