C Foundation

What is C? C Compiler Installation C Extensions C Compiler C Interpreter C Program Structure

C Basics

C Keywords C Data Types C Identifiers C Variables C Constant C Escape Sequences C Constant and Volatile C Typecast

Operators

What is Operator C Comma Operator C Arithmetic Operators C Relational Operators C Logical Operators C Bitwise Operators C Conditional Operators C : : Operator C Operator Priority

Basic IO's

Basic IO's C Formatted Functions C Unformatted Functions C Common Functions

Control Statements

What is Control Statement C if Statement C if else Statement C Nested if Statement C Else if Statement C Break Statement C Continue Statement C Switch Statement C Goto Statement

Looping

What is Control Loop C for Loop C Nested for Loop C while Loop C Nested while Loop C do while Loop C Nested do while loop

Functions

What is Function C User Defined Functions C Recursion C Passing Parameters

Scope

Scope C Local Scope C Global Scope

Storage Classes

What is Storage Class C Auto C Extern C Static C Register

Array

What is Array C One Dimensional Array C Two Dimensional Array C Multi Dimensional Array C Arrays Of Strings

String

What is String C String Functions

Pointer

What is Pointer C Pointers Arithmetic C Pointer to Pointer C Pointers and Arrays C Pointers and Strings C Pointer to Functions Void Pointers Null Pointers C Null and Void Pointer

Structure

What is Structure C Struct within Struct C Array within Structure C Pointer to Structure C Structure and Function C Enum C Bitfield Structure C Type def

Union

What is Union

Files

What is File C read a file C write a file C File Handling C Error Handling C Low Level Disk I/O C Other file functions

Memory Allocation

What is Memory Allocation C Malloc() C Calloc() C Free() C Realloc() C Coreleft()

C Reference

All ASCII Code Basic C Questions

C Interview

C Interview Sets All Star Patterns All Number Patterns All Alphabet Patterns All Series Patterns
The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Escape Sequences

What Escape Sequences Means?

In C Programming, the word escape sequences means to escape the character from the sequences of words and give special meaning to the escaped character.

C Escape Sequences

Example

Let us consider the following word "hello\nworld". Clearly, n is the character which escapes from the sequences of word, helloworld and a special meaning is given to n i.e) new line.

Escape Sequences Facts

  • An Escape sequences are non-printing characters.
  • An Escape sequences are certain characters associated with  \  (backslash).
  • An Escape sequences always begin with  \  (backslash) and is followed by one character.
  • An Escape sequences are mostly used in printf() statement.

Escape Sequences Table

There are 12 escape sequences in C Programming. They are

Escape Sequence Use ASCII Value
\n New Line 010
\t Horizontal tab 009
\b Backspace 008
\r Carriage Return 013
\a Alert Bell 007
\' Single quote 039
\" Double quote 034
\? Question 063
\\ Backslash 092
\f Form feed 012
\v Vertical tab 011
\0 Null 000

\n Escape Sequence

newline.c
#include <stdio.h>
int main()
{
printf("Hello \nProgrammer ");
return 0;
}
  • Hello
  • Programmer

Note:

Statement followed by \n will be printed in New Line.

\t Escape Sequence

horizontalspaces.c
#include <stdio.h>
int main()
{
printf("Hello\tProgrammer ");
return 0;
}
  • Hello        Programmer

Note:

Statement followed by \t will be printed after 8 space.

\b Escape Sequence

backspace.c
#include <stdio.h>
int main()
{
printf("Hello\b Programmer ");
return 0;
}
  • Hell Programmer

Note:

\b will backspace a character.

\r Escape Sequence

returncarriage.c
#include <stdio.h>
int main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
return 0;
}
  • hai

Note:

  • \n will print its defined characters in New line. ie) ab.
  • \b will backspace a character. ie) asi.
  • \r will replace the existing characters by its defined characters(ha) ie) hai.

\a Escape Sequence

alarm.c
#include <stdio.h>
int main()
{
printf("This will make a bell sound\a ");
return 0;
}
  • This will make a bell sound

Note:

\a will audio you a bell sound 🔔.

\' Escape Sequence

singlequote.c
#include <stdio.h>
int main()
{
printf("\'Hello Programmer\' ");
return 0;
}
  • 'Hello Programmer'

Note:

\' will print single quote '.

\" Escape Sequence

doublequote.c
#include <stdio.h>
int main()
{
printf("\"Hello Programmer\" ");
return 0;
}
  • "Hello Programmer"

Note:

\"\" will print double quote ".

\? Escape Sequence

questionmark.c
#include <stdio.h>
int main()
{
printf("How are you\? ");
return 0;
}
  • How are you?

Note:

\? will print? (Question mark).

\\ Escape Sequence

backslash.c
#include <stdio.h>
int main()
{
printf("C\\learn\\from\\2braces.com ");
return 0;
}
  • C \ learn\ from\ 2braces.com

Note:

\\ will print a single backslash (\).

\f Escape Sequence

formfeed.c
#include <stdio.h>
int main()
{
printf("\f - female sign. ");
return 0;
}
  • ♀ - female sign.

Note:

\f will print female sign ().

\v Escape Sequence

formfeed.c
#include <stdio.h>
int main()
{
printf("\v - male sign. ");
return 0;
}
  • ♂ - male sign.

Note:

\v will print male sign ().

\0 Escape Sequence

formfeed.c
#include <stdio.h>
int main()
{
printf("Hello \0 Programmer ");
return 0;
}
  • Hello

Note:

The statement followed by \0 will not display.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report

We to update you