I'm trying learn gnu c++. And already found a problem. Why the following first code snippet complains but the other doesn't?
Code:
int **aa = new int*[3];
aa[0] = new int[2];
*(*(aa + 0) + 0) = 1;
cout << (*aa[0])[0] << endl; //complains about: error: invalid types `int[int]' for
//array subscript
--------------------------------------------------------------------------------------------------------------
string *first_names[100];
string first = "LLLL";
first_names[0] = new string(first);
cout << (*first_names[0])[0] << endl; //doesn't complain
I can access one array with this notation but not the other? Can anyone kindly explain?
Thanks.