C++ problem

michael michael8110 at terra.com.br
Sat Aug 7 01:05:48 PDT 2004

Daniel,thanks a lot,in fact using 'string' did it.Björn,very nice to read  
you again,i still have to look at your message more closely,but what is  
really difficult for me to understand at this point is why
using namespace std;
int main()
{char a[20]="citroen";
return 0;

   michael ~ # ./a.out


using namespace std;
class car
char itsName[20];

int main()
{car c;
return 0;

returns this error message

   michael ~ # g++ ./test2.cpp
test2.cpp: In function `int main()':
test2.cpp:12: error: invalid conversion from `const char*' to `char'  
(ISN'T it the same to write char a[20]="citroen"; and  
c.itsName[20]="citroen"; since itsName[20] is a char in the class  
declaration?I tried using string,as Daniel and you suggested and  
everything worked fine,but i still would like to see through this.Thanks  

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

More information about the lfs-chat mailing list