Riphah International University Islamabad: Escape Sequence of C++
Riphah International University Islamabad: Escape Sequence of C++
Name: Nouman Arshad Roll No: 09B12CE CMS No: 2132 Semester: 6(A) Subject: Introduction To Programming Topic: Escape Sequence of C++ Submitted To: Sir Muhammad Bilal Butt
ESCAPE SEQUENCE
Escape sequences are used in programming languages C and C++. These are character combinations which comprise a backslash (\) followed by some character. They give results such as getting to the next line or a TAB space. They are called escape sequences since the backslash causes an "escape" from the normal way characters are interpreted by the compiler. Escape sequences are typically used to specify actions such as carriage returns and tab movements on terminals and printers. They are also used to provide literal representations of nonprinting characters and characters that usually have special meanings, such as the double quotation mark ("). The following table lists the ANSI escape sequences and what they represent. Escape sequences allow you to send non-graphic control characters to a display device. For example, the ESC character (\033) is often used as the first character of a control command for a terminal or printer. Some escape sequences are device-specific. For instance, the vertical-tab and form feed escape sequences (\v and \f) do not affect screen output, but they do perform appropriate printer operations. The most popular escape sequences you will be using are the new line (n) and the horizontal tab (t). The new line can also be substituted with endl and the result will be the same. \n \t \v \b \r \f \a \\ \? \' \" Newline Horizontal Tab Vertical Tab Backspace Carriage Return Form feed Audible Alert (bell) Backslash Question mark Single quote Double quote
\xhh Hex number Escape Sequence \a \b \f \n \r \t \v \' \" \\ \? \ ooo \x hh \x hhhh Represents Bell (alert) Backspace Form feed New line Carriage return Horizontal tab Vertical tab Single quotation mark Double quotation mark Backslash Literal question mark ASCII character in octal notation ASCII character in hexadecimal notation Unicode character in hexadecimal notation if this escape sequence is used in a wide-character constant or a Unicode string literal.