void ClearGrid(int Grid[3][3]);
int Grid[3][3];
int main ()
{
ClearGrid(Grid); // I need to somehow return Grid back to the program
}
Passing a 2D array by Reference
How can I do this.
I googled it and saw something about using a pointer
int **myArray or something. I haven't managed to get anything working yet..
void ClearGrid(int* p){ *(p + 1) = 100; //grid[0][1] ends up as 100};int main(){ int Grid[3][3]; ClearGrid(*Grid); return 0;}
maybe this is what you saw?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement