Home >Backend Development >C++ >What are Digraphs and How are They Used in C and C ?
Digraphs in C and C
Digraphs are two-character sequences that represent special characters in the C and C programming languages. They were introduced in C99 to provide compatibility with older systems that did not support the full ISO 646 character set.
The following digraphs are supported in C and C :
These digraphs allow programmers to use these special characters even if they do not have a keyboard that supports them. For example, the following code is valid C and C :
<code class="c">#include <stdio.h> #ifndef BUFSIZE #define BUFSIZE 512 #endif void copy(char d<::>, const char s<::>, int len) { while (len-- >= 0) { d<:len:> = s<:len:>; } }</code>
The digraph <::> is used to represent the # character, which is necessary for preprocessor directives.
The above is the detailed content of What are Digraphs and How are They Used in C and C ?. For more information, please follow other related articles on the PHP Chinese website!