kiran
2012-09-25 20:14:54 UTC
Here is a code snippet:
=============
int **ptr;
int intArr[3][5];
ptr = intArr;
=============
This gives the error on g++ compiler:
error: cannot convert ‘int [3][5]’ to ‘int**’ in assignment
I have tried other variants as well, like
int const **ptr = intArr;
and
ptr = &intArr[0];
I still got the same error. Can anyone explain the reason here.
Thanks,
Kiran
=============
int **ptr;
int intArr[3][5];
ptr = intArr;
=============
This gives the error on g++ compiler:
error: cannot convert ‘int [3][5]’ to ‘int**’ in assignment
I have tried other variants as well, like
int const **ptr = intArr;
and
ptr = &intArr[0];
I still got the same error. Can anyone explain the reason here.
Thanks,
Kiran
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]