escape character in c # code example

Example 1: escape sequence in c++

Escape sequence	Hex value in ASCII	Character represented
\a	07	Alert (Beep, Bell) (added in C89)[1]
\b	08	Backspace
\enote 1	1B	Escape character
\f	0C	Formfeed Page Break
\n	0A	Newline (Line Feed); see notes below
\r	0D	Carriage Return
\t	09	Horizontal Tab
\v	0B	Vertical Tab
\\	5C	Backslash
\'	27	Apostrophe or single quotation mark
\"	22	Double quotation mark
\?	3F	Question mark (used to avoid trigraphs)
\nnnnote 2	any	The byte whose numerical value is given by nnn interpreted as an octal number
\xhh…	any	The byte whose numerical value is given by hh… interpreted as a hexadecimal number
\uhhhhnote 3	none	Unicode code point below 10000 hexadecimal
\Uhhhhhhhhnote 4	none	Unicode code point where h is a hexadecimal digit

														//code by gokul aakash

Example 2: c escape characters

Escape		HEX in ASCII	Character represented
\a			07				Alert (Beep, Bell) (added in C89)
\b			08				Backspace
\e			1B				Escape character
\f			0C				Formfeed Page Break
\n			0A				Newline (Line Feed); see notes below
\r			0D				Carriage Return
\t			09				Horizontal Tab
\v			0B				Vertical Tab
\\			5C				Backslash
\'			27				Apostrophe or single quotation mark
\"			22				Double quotation mark
\?			3F				Question mark (used to avoid trigraphs)
\nnn		any				The byte whose numerical value is given by nnn interpreted as an octal number
\xhh…		any				The byte whose numerical value is given by hh… interpreted as a hexadecimal number
\uhhhh		none			Unicode code point below 10000 hexadecimal
\Uhhhhhhhh	none			Unicode code point where h is a hexadecimal digit

Tags:

C Example