Home > Article > Backend Development > What does '\n' mean in c++
In C, '\n' is an escape character that represents a newline character, which moves the cursor to the next line during output or display. Its uses include: 1. Output newline; 2. Input skip; 3. File reading and writing (representing line separators in text files).
The meaning of '\n' in C
In C, '\n' is an escape character, representing a newline character. It is a non-printable character that moves the output cursor to the next line when printing or displaying a string containing '\n'.
'\n' uses include:
<code class="cpp">cout << "第一行" << '\n'; cout << "第二行";</code>
It should be noted that the actual representation of '\n' depends on the operating system and character set. In Windows, '\n' means carriage return line feed (CRLF), i.e. "\r\n". On Unix and macOS systems, '\n' represents the newline character (LF).
The above is the detailed content of What does '\n' mean in c++. For more information, please follow other related articles on the PHP Chinese website!