Escape sequences are specially sequenced characters used to format output. - C Language Basics

C examples for Language Basics:printf

Introduction

The escape sequence \n tells the program to add a new line.

Take a look at the following program statement.

The following table describes some common escape sequences.

Escape Sequence Purpose
\nCreates a new line
\tMoves the cursor to the next tab
\rMoves the cursor to the beginning of the current line
\\Inserts a backslash
\"Inserts a double quote
\'Inserts a single quote

How many new lines are added to standard output with this one printf() function?

Demo Code


#include <stdio.h>

int main()/*from   w  w  w. j  a  v a2  s  .c om*/
{
    printf("\nC you \nla\nter\n"); 

    return 0;
}

Result


Related Tutorials