What are Backslash character constants in C language?



A backslash ( \ ) that allows a visual representation of some nongraphic characters introduces an escape.

One of the common escape constants is the newline character (
).

Backslash Characters

The backslash characters are as follows −

CharacterMeaning
‘\a’alert
‘\b’backspace
‘\f’form feed

newline
‘\t’horizontal tab
‘\r’carriage return
‘\v’vertical tab
‘\’backslash
‘\’ ’single quote
‘\" ’double quote
‘\?’Question mark

Example program

Following is the C program for the backslash character constants −

Example

 Live Demo

#include<stdio.h>
#define PI 3.14
float area;
void main(){
   double r;
   r=1.0;
   area = PI * r * r;
   printf("Area is %d 
", area); // /n is used to enter the next statement in newline }

Output

Area is 1492442840

Advertisements