Standard C++ Library Reference ISO/IEC (VERSION3)
Next
Characters
Character Sets · Character Sets and Locales · Escape Sequences · Numeric Escape
Sequences · Trigraphs · Multibyte Characters · Wide-Character Encoding
Characters play a central role in Standard C. You represent a C program as one or more source
files. The translator reads a source file as a text stream consisting of characters that you can read
when you display the stream on a terminal screen or produce hard copy with a printer. You
often manipulate text when a C program executes. The program might produce a text stream
that people can read, or it might read a text stream entered by someone typing at a keyboard or
from a file modified using a text editor. This document describes the characters that you use to
write C source files and that you manipulate as streams when executing C programs.
Character Sets
When you write a program, you express C source files as text lines containing characters from
the source character set. When a program executes in the target environment, it uses
characters from the target character set. These character sets are related, but need not have the
same encoding or all the same members.
Every character set contains a distinct code value for each character in the basic C character
set. A character set can also contain additional characters with other code values. For example:
The character constant 'x' becomes the value of the code for the character
corresponding to x in the target character set.
●
The string literal "xyz" becomes a sequence of character constants stored in successive
bytes of memory, followed by a byte containing the value zero:
{'x', 'y', 'z', '\0'}
●
A string literal is one way to specify a null-terminated string, an array of zero or more bytes
followed by a byte containing the value zero.
Visible graphic characters in the basic C character set:
Form Members
letter A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m
n o p q r s t u v w x y z
digit 0 1 2 3 4 5 6 7 8 9