void func (int** arr, int x, int y){ for(int i = 0; i < x; ++i) { for(int j = 0; j < y; ++j) arr[i][j] = i * j; }}
And not have to worry about the i*y + j shiznit.
I''m pretty sure Oluseyi is right on this one. Sure you could do it the other way, but why would you want to?? This is much more clear. Plus if you are passing a 2D array to the other version then you might (I''m not sure) get a type warning/error, and you might have to cast the 2D array (int**) to a 1D array (int*).
And we haven''t even begun to get into semantics..
But whatever...