C - Introduction Escape Sequences

Introduction

The following table shows all the escape sequences that you can use.

Escape sequence Description
\n Represents a newline character
\r Represents a carriage return
\b Represents a backspace
\f Represents a form-feed character
\t Represents a horizontal tab
\v Represents a vertical tab
\a Inserts a bell (alert) character
\? Inserts a question mark ( ?)
\" Inserts a double quote ( ")
\' Inserts a single quote ( ')
\\ Inserts a backslash (\)

Demo

#include <stdio.h>                // Include the header file for input and output

int main(void)
{
      printf("Hi there!\n\n\nThis program is a test");
      printf(" test.");
      printf("\test test test.\n\n\n\a\a");
      printf("What was that???\n\n");
      printf("\t1.\tA ?\n");
      printf("\t2.\tA ?\n");
      printf("\t3.\tA ?\n");
      printf("\n\t\t\b\btehis is test test test test tes t testut?\n\n");
      return 0;/*  w  ww. j av a  2  s  .c  o  m*/
}

Result

Related Topics

Quiz