I have a basic program:
Code:
char chTest; chTest = 'a'; qDebug() << chTest;
However if I use "a", it spits out an error at me - 47: error: invalid conversion from 'const char*' to 'char'
What does that error mean? And why does it occur?
Printable View
I have a basic program:
Code:
char chTest; chTest = 'a'; qDebug() << chTest;
However if I use "a", it spits out an error at me - 47: error: invalid conversion from 'const char*' to 'char'
What does that error mean? And why does it occur?
Code:
char c = 'a'; // one character char *str = "a"; // string literal
Error says it, keeping the const qualifier aside in the error ouput, looks like you are converting from 'char' to 'char*'.Quote:
However if I use "a", it spits out an error at me - 47: error: invalid conversion from 'const char*' to 'char'
'char' and 'char*' are different types and cannot be assigned / implicitly converted.
When you bring in const back in discussion. One can convert 'const char*' to 'char*', but other way 'char*' to 'const char*', is not implicitly possible.