0

Passing arrays to functions (C++)

Hello, I have a question, is it possible to pass a two dimensional array to a function? and how can I do that?

23rd Aug 2018, 3:22 PM
Shukri Dozom
Shukri Dozom - avatar
1 Réponse
- 1
Shukri Dozom , please refer below: // declaration...can only ommit first value [][] is not allowed. void printArray(int Array2D[][3]) { cout << Array2D[0][0] << endl; } // array in main int Array2D[2][3] = {{1,2,3},{4,5,6}}; // function call in main printArray(Array2D);
23rd Aug 2018, 4:11 PM
Ketan Lalcheta
Ketan Lalcheta - avatar