String constants and Backslash character constants or escape sequences in C

String constants: A string is set of characters inside double quotes. In C you can define string contacts but there is no data type for a string constant.

Backslash character constants or escape sequences: For situations like if you want a new line or a backspace, a backslash character constant is used. Example:

#include <stdio.h>

void main()


printf(“\nMore Process.”);

return 0;


Output: Output of this program is a new line and then More Process is printed.

Backslash character constants:

Code Application
\b Backspace
\f Form feed
\n New line
\t Horizontal tab
\r Carriage return
\\ Backslash
\v Vertical tab
\a Alert
\” Double quote
\’ Single quote
\0 Null
\? Question mark
\N Octal constant (N is octal constant)
\xN Hexadecimal constant ( N is hexadecimal constant

Leave a Reply