I am trying to return a pointer address to my main function but it isn't working. I am using Windows 98, Visual Studio 6.0 and making my program for a win 32 console application. I have put the function that I am working on below. The purpose of this program is to complete an assignment for school. What this function is to do is to take a complex array of predefined numbers and square them, storing the result in the original array. I am pretty sure that I have messed this up badly.

I have a couple of questions about this as well.

I am using pointers because I am under the impression that if you just pass the array the contents are protected, and would not be changed when the function returns. Is this true?

The instruction and the book that in the course that I am taking has not been the best. Does anyone know where I can find a good explanation of using pointers, functions and structs?


int square_function(int * original[][COLUMNS], int rows)
{
int i, j;
for (i=0 ; i < rows ; i++)
for (j=0 ; j < COLUMNS ; j++)
*original[i][j] = (*original[i][j] * 2);

return (*original);
}


Thank you for any help or direction.