Home Show/Hide Menu
C Tutorials
➜ C Language
  - Features of C
  - First C Program
  - Compilation in C
  - C Character Set
  - Tokens
  - Keywords
  - Identifiers
  - Constants
  - Operators
  - Data Types
  - Variables
  - Type Casting
  - Comments
  - Input/Output
  - Escape Sequence
  - Programming Errors
➜ Control Statements
  - if Statement
  - if-else Statement
  - Nested if-else
  - else-if
  - switch Statement
  - Loop
  - while loop
  - do while loop
  - for loop
  - break
  - continue & goto
  - Nested Loop
  - Infinite Loop
➜ Functions
  - What is function
  - Call by Value & Reference
  - Recursive function
  - Storage Classes
➜ Array
  - 1-D Array
  - 2-D Array
  - Return an Array
  - Array to Function
➜ C Pointers
  - Pointers
  - Pointer to Pointer
  - Pointer Arithmetic
  - Dangling Pointers
  - sizeof() operator
  - const Pointer
  - void pointer
  - Dereference Pointer
  - Null Pointer
  - Function Pointer
  - Function pointer as argument
➜ Memory Management
  - Memory Layout of C
  - Dynamic memory
  - calloc()
  - malloc()
  - realloc()
  - free()
➜ Strings
  - gets() & puts()
  - String Functions
  - strlen()
  - strcpy()
  - strcat()
  - strcmp()
  - strrev()
  - strlwr()
  - strupr()
  - strstr()
➜ C Math
  - Math Functions
➜ Enum, Structure & Union
  - Enum
  - Structure
  - typedef
  - Array of Structures
  - Nested Structure
  - Structure Padding
  - Union
➜ File Handling
  - fprintf() fscanf()
  - fputc() fgetc()
  - fputs() fgets()
  - fseek()
  - EOF and feof()
  - fsetpos()
  - tmpfile()
  - rewind()
  - ftell()
  - lseek()
➜ Preprocessor
  - Preprocessor
  - Macros
  - #include
  - #define
  - #undef
  - #ifdef
  - #ifndef
  - #if
  - #else
  - #error
  - #pragma
➜ Command Line
  - Arguments

Escape Sequence in C Language

An escape sequence in C language is a sequence of characters that denotes a different meaning from its actual meaning and undergoes a change from its normal form when used inside string literal or character. It is composed of two or more characters starting with backslash \.


List of Escape Sequences in C

 Escape Sequence  Meaning
\aAlarm or Beep
\bBackspace
\e Used For Escape Characters 
\fForm Feed
\nNew Line
\rCarriage Return
\tTab (Horizontal)
\vVertical Tab
\\Backslash
\'Single Quote
\"Double Quote
\?Question Mark
\nnnOctal Number
\N Octal Constant 
\xhh Hexadecimal Number 
\XN Hexadecimal Constant 
\0Null

#include<stdio.h>
void main()
{
	printf("\nLearn Easy Tutorial For Escape Sequences!\n\n");
	printf("Print a new\nline!\n");// newline!
	printf("\'Hello World\'!\n"); // single quotation!
	printf("20\v30\n"); // vertical tab!
	printf("\"Escape Sequences!\"\n"); // double quotation!
	printf("Hello!");
	printf("\r"); // carriage return!
	printf("An example!\n");
	printf("What are you doing\?\n"); // question mark!
	printf("E:\\LearnEasy\\LearnC\n"); // backslash!
	
	char* oct = "B\142";    // Octal Value!
	printf("%s\n", oct);	// Print Octal Value!
	
	char* hexval = "B\x2L"; // Hexadecimal Value
	printf("%s\n", hexval); // Print Hexadecimal Value!
}

Output :

Learn Easy Tutorial For Escape Sequences!

Print a new
line!
'Hello World'!
20
30
"Escape Sequences!"
An example!
What are you doing?
E:\LearnEasy\LearnC
Bb
BL




ADVERTISEMENT