Why double standard?
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]; Thanks. |
aa[0] is of type int*
*aa[0] is of type int (and equivalent to aa[0][0]) firstnames[0] is of type string* *firstnames[0] is of type string (and equivalent to firstnames[0][0]) std::string overloads operator[], int doesn't; that's why (*aa[0])[0] will give you an error. You probably meant aa[0][0] (and firstnames[0][0]). |
Thank you for clearing this up for me. I'm enjoyin' every moment of c++. Again thanks.
|
All times are GMT -5. The time now is 02:10 AM. |