Hey guys (and girls) I'm not new to C++ but it has been a while since I've used it. I'm having an issue that I can't seem to place my finger on. I have the two bits of code below. The first comes out fine, or as I expect the second does not. Can someone please explain why?
double test[3][2] = {{1, 2}, {3, 4}, {5, 6}};
cout << sizeof(test) << " " << sizeof(*test) << " " << sizeof(**test) << endl;
result: 48 16 8
double** test = new double*[3];
test[0] = new double[2];
test[1] = new double[2];
test[2] = new double[2];
test[0][0] = 1;
test[0][1] = 2;
test[1][0] = 3;
test[1][1] = 4;
test[2][0] = 5;
test[2][1] = 6;
cout << sizeof(test) << " " << sizeof(*test) << " " << sizeof(**test) << endl;
result: 8 8 8
I'm expecting the same result, what am I doing wrong here?