Here is my code in c++.
void multTable(int arr[][], int maxNum);
Before the main method, I declared this function prototype and then defined it after the main method towards the bottom of my code. However, I get an error stating that multidimensional array must have bounds for all dimensions. I don't understand how I can fix this.
If your 2D arrays will have a fixed column size. You can do this:
void multTable(int arr[][MAX_COLS], int maxNum);
You'll have to call it like this:
#define MAX_ROWS (5)
#define MAX_COLS (7)
int arr[MAX_ROWS][MAX_COLS] = {...};
multTable(arr, 7);
You may use this prototype:
template <int ROW, int COLUMN>
void multTable(int (&arr)[ROW][COLUMN], int maxNum);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With