Im trying to declare a pointer to a 2d float matrix in order to have a dynamical behaviour of my image data but Im having a compilation error C2057: expected constant expression. I thought a pointer had to be casted in that way but apparently not.. Please anyone could help me ? Thanks!!
//Image size input
int imheight;
int imwidth;
cout << "Please, enter image height: \n>";
scanf ("%d",&imheight);
cout << "Please, enter image width: \n>";
scanf ("%d",&imheight);
const int imheight2 = imheight;
const int imwidth2 = imwidth;
float *zArray[imheight2][imwidth2];
Here is one of my other functions where I´m trying to hace access to zArray. Im not getting the data properly read:
void LoadRIS( char* inputFileName , float** zArray, int imageHeight , int imageWidth){
// Load input RIS file
FILE* lRis = fopen ( inputFileName, "rb" );
// Jump to data position
for (int i = 0; i < 88; i++){
uchar a = getc (lRis);
}
// Read z array
size_t counter = fread ( *zArray , 1 , imageHeight * imageWidth * sizeof(zArray) , lRis );
//Get max value of RIS
float RISmax = zArray [0][0];
float RISmin = zArray [0][0];
for (int i=0; i<imageHeight; i++)
{
for (int j=0; j<imageWidth; j++)
{
if (zArray[i][j] > RISmax)
RISmax = zArray [i][j];
if (zArray[i][j] < RISmin)
RISmin = zArray [i][j];
}
}
std::cout<<"The max value of the RIS file is: "<<RISmax<<"\n";
std::cout<<"The min value of the RIS file is: "<<RISmin<<"\n";
Beep(0,5000);
// Close input file
fclose (lRis);
}