Be prepared for some confusing answer.
\ is an escape character (for example, you've probably already encountered the escape sequence \n ), and \\ is an escape sequence that represents a single character \ (in a sense, this can be understood as escape of an escape character). If you really want to have \\ in your line, you will need to use \\\\ :
std::cout << "\\\\something\\" << std::endl;
To provide another example, suppose you want to have the string " in the string. "
const char *str = "Hello "World"";
obviously will not compile, and you will need to escape " with \ :
const char *str = "Hello \"World\"";
source share