A
A
Azilon2017-10-03 17:52:57
C++ / C#
Azilon, 2017-10-03 17:52:57

What is the essence of the problem?

I saw this example in one of the books:
const string exclam = "!";
const string message = "hello" + " , world" + exclam;
There was a suggestion to try to determine if the program would work or not, but there were no further comments. I understand that the problem is with the quote before the "world", but what is the essence of the problem is not clear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devalone, 2017-10-03
@devalone

Try to compile and see what the problem is, "hello" is not a string, but a const char[]. To make it work, you can, for example, do this:
Now hello - std::string for which operator + is overloaded

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question