" for strings? I just tried to compile some C ++ code that used the alphabetic character Tab (like I press...">

Why use "\ t" instead of "<press TAB>" for strings?

I just tried to compile some C ++ code that used the alphabetic character Tab (like I pressed a key TABon my keyboard) inside the line. And, to my surprise, it is well composed. Looking back, I suggest that this makes sense, as it is a character, like any other.

cout << "Tab: [TAB]";

So far, I have always used \tto define tabs in strings.

cout << "Tab: [\t]";

Obviously, code that uses a literal TABin strings will suffer greatly in readability, but is there a technical reason to use \tbesides the convention?

+4
1

\t ?

, .

cout << "Tab: [\t]";

.

, , . UTF8 , EBCDIC .
'\t' , .


, merlin2011 comment, IDE TAB .

+6

Source: https://habr.com/ru/post/1629965/


All Articles