I'm trying to input a 2D array into a function. I don't know the number of rows or columns to this array and it was loaded into c++ via CImg. This is what I have:
// Main function:
int main()
{
int rows, columns;
float summation;
CImg<unsigned char> prettypicture("prettypicture.pgm");
rows = prettypicture.height();
columns = prettypicture.width();
summation = SUM(prettypicture[][], rows, columns);
}
// Summation function:
float SUM(int **picture, int rows, int column)
{
... // there is some code here but I don think this is important.
}
I would like to pass the array into the summation function and I'm aware that I should be using pointers in some way, but I'm not sure how to do this. Any help would be much appreciated.
Thank you
(sorry for being a noob)