Hi every one
i learned how to pass one dimensional array to a function, i did the same way with two dimensions but i failed .
can any one help me with this issue?
Many thanks
yes iam sorry i thought you meant the way for passing one dimensional array, i did it this way but i failed , i know the way you show me works fine i run your code, but in case i want to pass the two dimensions to the function i failed to do it correctly ..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void print(int arr[][], int width,int h)
{
for (int i = 0; i < width; ++i) {
for(int j = 0; j < h; ++j)
std::cout << arr[i][j] << ' ';
std::cout << '\n';
}
}
int main()
{
int array[2][5] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 0}};
print(array, 2 ,5);
}