In computer programming ,digraph and trigraphs are sequences of two and three characters respectively,appearing in source code ,which a programming language specification requires an implementation of that language to treat as if they where one other character .Digraph and trigraphs used because keyboard may not have keys to cover the entire character set of the language ,input of special characters may be difficult,text editors may reserve some characters for special use and so on .Trigraphs might also be used for some EBCDIC code pages that lack { and } type characters.Trigraphs are not commonly encountered outside compiler test suites.Some compiler support an option to turn recognition of trigraphs off or disable trigraphs by default and require an option to turn them on.Some can issue warning when they encounter trigraphs in source files.
The digraph characters are:
%: or %% # number sign
<: [ left bracket
:> ] right bracket
<% { left brace
%> } right brace
%:%: or %%%% ## preprocessor macro concatenation operator
Trigraph
Single character capription
??= # pound sign
??( [ left bracket
??) ] right bracket
??< { left brace
??> } right brace
??/ \ backslash
??' ^ caret
??! | vertical bar
??- ~ tilde
Escape Sequences :-A escape sequence is a series of characters used to change the state of computers and their attached peripheral devices .These are also known as control sequence reflecting their use in device control .Some control sequences are special characters that always have the same meaning.Escape sequence uses an escape character to change the meaning of the characters which follow it ,meaning that the characters can be interpreted as a command to be executed rather than as data.
Escape sequence are commonly used when a computer and a peripheral have only a single channel through which to send information back and forth.Normally we use following escape sequences which are written with their meaning:
\\ Literal backslash
\" Double quote
\' Single quote
\n Newline (line feed)
\r Carriage return
\b Backspace
\t Horizontal tab
\f Form feed
\a Alert (bell)
\v Vertical tab
\? Question mark (used to escape trigraphs)
\nnn Character with octal value nnn
\xhh Character with hexadecimal value hh
The digraph characters are:
%: or %% # number sign
<: [ left bracket
:> ] right bracket
<% { left brace
%> } right brace
%:%: or %%%% ## preprocessor macro concatenation operator
Trigraph
Single character capription
??= # pound sign
??( [ left bracket
??) ] right bracket
??< { left brace
??> } right brace
??/ \ backslash
??' ^ caret
??! | vertical bar
??- ~ tilde
Escape Sequences :-A escape sequence is a series of characters used to change the state of computers and their attached peripheral devices .These are also known as control sequence reflecting their use in device control .Some control sequences are special characters that always have the same meaning.Escape sequence uses an escape character to change the meaning of the characters which follow it ,meaning that the characters can be interpreted as a command to be executed rather than as data.
Escape sequence are commonly used when a computer and a peripheral have only a single channel through which to send information back and forth.Normally we use following escape sequences which are written with their meaning:
\\ Literal backslash
\" Double quote
\' Single quote
\n Newline (line feed)
\r Carriage return
\b Backspace
\t Horizontal tab
\f Form feed
\a Alert (bell)
\v Vertical tab
\? Question mark (used to escape trigraphs)
\nnn Character with octal value nnn
\xhh Character with hexadecimal value hh
No comments:
Post a Comment