passing a 2D array to a function

how do i pass a 2d array to a function in this code: int main(){ int x,y; cin >> x; cin >> y; int grid[y][x]; myFunc(grid); }

6/13/2019 7:08:48 AM

Cat Sauce

2 Answers

New Answer


Exactly as you did- myFunc(grid); The problem is that you cant declare an array with a non-fixed length, you need to use "new" for that


daniel what do you mean?