C++ problem (one last try)

michael michael8110 at terra.com.br
Sun Aug 8 00:40:53 PDT 2004

Sorry for my mistake,i was really confusing the declaration of an array  
e.g. char a[20]  with the 21st element a[21],so the keyboard recovered :-).
But,the below code seems to be free of such mistakes,uses a constructor  
(that should be then initialisation) but still gives the same error  
error: incompatible types in assignment of `char*' to `char[20]'  on line  
7.As far as i can see,i'm assigning char* to char*,or?As always please  
don't bother if this seems excessive,and thanks again!

using namespace std;
class car
char itsName[20];
car(char a[20]){itsName=a;} //line 7

int main()
{car c("citroen");

return 0;

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

More information about the lfs-chat mailing list