M
M
Maxim Siomin2020-06-24 23:04:49
C++ / C#
Maxim Siomin, 2020-06-24 23:04:49

Why are different quotes treated differently?

In python, I'm used to always writing print('Hello, world'), not print("Hello, world").

In C++, if I write std::cout << 'Hello, world';, then visual studio underlines and gives a warning.
And if you write std::cout << "Hello, world";, then everything compiles without comment.

In general, the essence of the issue.
Is it possible to use single quotes (apostrophes) in c++?
If so, is there any way to disable the warning in visual studio?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Pavlov, 2020-06-25
@MaxSiominDev

In c++/c#, quotes ' 'are used for the char data type and can hold 1 character, while quotes
" "are of type string , that is, an array of characters and can span multiple characters.

D
Developer, 2020-06-25
@samodum

Learn the syntax of the language you are writing in.
In apostrophes, char, a single character.
In quotes - a string.
Books must be read

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question