I'm having an issue creating a pointer to a multidimensional list. In the case of the single array - no problems output is as it should be. In the case of the multidimensional array - an error message is generated.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int ROWS = 3, COLS = 4;
int list[ROWS][COLS] = { {4, -3, 5, 6}, {5, 1, 7, 2},{-4,6,10,-8}};
int list2[] = {3, 6, 9, 2};
int *plist = list;
int *plist2 = list2;
for (int row = 0; row < ROWS; row++)
{
for (int col = 0; col < COLS; col++)
cout << setw(4) << list[row][col] << " ";
cout << endl;
}
cout << *plist << endl;
cout << *plist2 << endl;
return 0;
}
main.cpp:11:14: error: cannot convert "int ()[4]" to "int" in initialization
int *plist = list;