The error confronting me is the compiler saying cannot convert ‘double*’ to ‘double’ in assignment
. My code is below.
double* initArray(int data[], int dimensionCount){
//data: element 0= number of dimensions
//element 1 through inf define the size of each dimension
//dimensionCount keeps track of the current dimension being manipulated by the function
//Allocate dynamic memory for the current dimension
double* output;
output=new double[data[dimensionCount]];
int i=dimensionCount;
while(i<data[dimensionCount]){
if( !(output[i]= initArray(data, dimensionCount++))){
std::cout<< "Error! Out of Memory!";
break;
}
i++;
}
//returning the generated array tacks on the generated dimension to the lower dimension preceding it
return output;
}
As output
is of type double*
and arrayInit
returns variables of type double*
, I don't know where it is trying to convert from a double
to a double*
. I found this, but it doesn't seem to apply, as data
is being passed correctly, and intArray
is returning a pointer to the array being generated, not the array itself, so there shouldn't be any type mismatch with output
.