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?
1 ответ
- 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);