Passing a 2D array by Reference

Started by
2 comments, last by clashie 14 years, 2 months ago
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 Grid[3][3]);

int Grid[3][3];

int main ()
{
    ClearGrid(Grid); // I need to somehow return Grid back to the program
}

Advertisement
void ClearGrid(int (&Grid)[3][3]);
Thanks!
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