C/C++ Trigraphs and Digraphs

by Shabbir on May 19, 2008

in C/C++

Trigraph is a sequence of three characters. The first two always are question marks "??".
Trigraphs are equivalent to some single characters. Here is a table from trigraphs and their equivalents

Trigraph

Equivalent

??!

|

??<

{

??>

}

??/

\

??'

^

??-

~

??=

#

??(

[

??)

]

This can cause some problems for new programmers. See this example

// This will be executed???????????/
i++;

This line of code will not be executed, because is used a trigraph "??/" the compiler will not compile the line.

Digraphs are used for the same issues as the trigraphs, see the digraphs

Digraph

Equivalent

<:

[

:>

]

<%

{

%>

}

%:

#

%:%:

##

Sharing is Caring...

Other Related Posts:

  1. Read From File In C++
  2. Write To File In C++
  3. How Java Virtual Machine (JVM) Works
  4. Functions in C++
  5. Write To File in C#

Leave a Comment

Spam protection by WP Captcha-Free

Previous post:

Next post:

    About the Author

  • author photo

    My Name is Shabbir Bhimani and I am developer by profession in the field of applications, web and database. Currently doing full time online marketing and like to share my experiences on how you can make money online @ CodeItWell.com. Read more ...


    See how you can get in touch with me.