A
Adam Hartshorne
The input to a function of a 3rd party library I want to use requires a
double**, which is a multi-dimension array of doubles.
I have looked on the net etc and seen several ways of supposedly doing
this, but I don't seem to be able to get them to work. I was wondering
if anybody can tell me what I am doing wrong.
int rows = 10 ;
int cols = 10 ;
double** data ;
data = new (double*)[rows] ;
for (int i = 0 ; i < rows ; i++) {
data = new double[cols];
}
main.cpp(291) : error C2143: syntax error : missing ';' before '['
main.cpp(291) : error C2337: 'rows' : attribute not found; it is neither
a built-in nor a custom attribute that is accessible in the current
namespace
both the error point to the data = new (double*)[rows] line
May I don't need to create the multi-dimension array this way, I don't
know. As mentioned above, I have a 3rd party library function that
requests double** data.
One point is that I won't know the row and column sizes until runtime.
Any suggestions would be much appreciated,
Adam
double**, which is a multi-dimension array of doubles.
I have looked on the net etc and seen several ways of supposedly doing
this, but I don't seem to be able to get them to work. I was wondering
if anybody can tell me what I am doing wrong.
int rows = 10 ;
int cols = 10 ;
double** data ;
data = new (double*)[rows] ;
for (int i = 0 ; i < rows ; i++) {
data = new double[cols];
}
main.cpp(291) : error C2143: syntax error : missing ';' before '['
main.cpp(291) : error C2337: 'rows' : attribute not found; it is neither
a built-in nor a custom attribute that is accessible in the current
namespace
both the error point to the data = new (double*)[rows] line
May I don't need to create the multi-dimension array this way, I don't
know. As mentioned above, I have a 3rd party library function that
requests double** data.
One point is that I won't know the row and column sizes until runtime.
Any suggestions would be much appreciated,
Adam