Escape Sequences That Represent Control Characters - C++ Data Type

C++ examples for Data Type:char

Introduction

Escape Sequence Control Character
\nNewline
\tHorizontal tab
\vVertical tab
\bBackspace
\rCarriage return
\fForm feed
\aAlert/bell
\\ Backslash
\' Single quote
\" Double quote
\? Question mark

Because the backslash signals the start of an escape sequence, to enter a backslash, use two successive backslashes \\.

The following code that uses escape sequences outputs a message to the screen.

Demo Code

#include <iostream>

int main()//from w w  w  . ja v a2 s  .  co  m
{
  std::cout << "\"Least \'said\' \\\n\t\tsoonest \'mended\'.\"" << std::endl;
}

Result


Related Tutorials