Escape Sequence

Character combinations consisting of a backslash (\) followed by a letter or by a combination of digits are called Escape Sequences. To represent a newline character, single quotation mark, or certain other characters in a character constant, we must use escape sequences.


Escape Sequence Represents
\n New line
\t Horizontal tab
\v Vertical tab
\' Single quotation mark
\" Double quotation mark
\\ Backslash
\b Backspace

CODE

#include <iostream>
using namespace std;
int main() {
    cout << "Coders\nCapsule" << endl;
    /*Output :
      Coders
      Capsule*/

    cout << "Coders\tCapsule" << endl; //Output : Coders Capsule
    cout << "Coders\bCapsule" << endl; //Output : CoderCapsule
    cout << "C:\\Program Files\\Adobe" << endl; //Output : C:\Program Files\Adobe
}