DIZNR INTERNATIONAL

The C Character Set – part 4.

The C Character Set – part 4.

https://www.gyanodhan.com/video/7A2.%20Computer%20Science/Let%20Us%20C%20Programming/186.%20Let%20Us%20C%20by%20Yashavant%20P.%20Kanetkar%20-%20The%20C%20Character%20Set%20-%20part%204.mp4

Here’s Part 4 of an overview of the C character set, assuming you’re continuing a breakdown of the C programming language’s fundamental elements. If you’d like this to match a previous format or style, feel free to share that.


The C Character Set – Part 4: Trigraphs and Digraphs

What are Trigraphs?

Trigraphs are sequences of three characters that represent a single character not easily available on some keyboards. Although rarely used today, they are part of the C standard for backward compatibility with older systems.

Trigraph Sequences

Trigraph Replaces Description
??= # Hash / Pound sign
??/ \ Backslash
??' ^ Caret
??( [ Left square bracket
??) ] Right square bracket
??! ` `
??< { Left curly brace
??> } Right curly brace
??- ~ Tilde

Example:

c
??=include <stdio.h> // Equivalent to #include <stdio.h>

Warning: Trigraphs are considered obsolete and can confuse readers. Most compilers disable them by default or issue warnings.


What are Digraphs?

Digraphs are two-character sequences that provide alternate ways to write some punctuation characters, particularly useful on systems where those characters are difficult to type.

Digraph Sequences

Digraph Replaces Description
<: [ Left square bracket
:> ] Right square bracket
<% { Left curly brace
%> } Right curly brace
%: # Hash / Pound sign

Example:

c
<% int arr<:3:> = <%1, 2, 3%>; %> // Equivalent to: int arr[3] = {1, 2, 3};

Note: Unlike trigraphs, digraphs are more accepted but still uncommon in modern codebases.


Summary


Would you like Part 5 to cover character classification (e.g., letters, digits, etc.), or something else like escape sequences, keywords, or operators?

The C Character Set – part 4.

The C programming Language