Thursday, May 12, 2016

Escape Sequences in C Language

Go to  IT HOME FB Page

Escape sequences are used in the programming languages C and C++, and also in many more languages (with some variations) like Java and C#. An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly.


In C, all escape sequences consist of two or more characters, the first of which is the backslash, \; the remaining characters determine the interpretation of the escape sequence. For example, \n is an escape sequence that denotes a newline character. The remainder of this article focuses on C; other programming languages are likely to have different syntax and semantics.

C interprets \n inside a character or string literal as a newline character, whatever that may be on the target system:


#include <stdio.h>
int main() {
    printf("Hello,\nworld!");
}




Out Put:  Hello,
world!





Escape Sequences in C Language
Escape Sequences in C Language









0 comments:

Post a Comment