Computer >> Computer tutorials >  >> Programming >> C programming

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 ( \n ).

Backslash Characters

The backslash characters are as follows −

CharacterMeaning
‘\a’alert
‘\b’backspace
‘\f’form feed
‘\n’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

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

Output

Area is 1492442840