Name
char type — Character type specifier
Synopsis
simple-type-specifier := char
The char
type represents a
character, sometimes called a narrow character. The char
type is distinct from signed
char
and unsigned
char
, but its representation must match one
or the other. (Which one depends on the implementation.) A char
can be promoted to an integer; the
value depends on whether the representation is signed or
unsigned.
By definition, sizeof(char)
is 1
, so a char
is often used as the basic unit of
memory allocation. Raw memory is often allocated as arrays of char
or unsigned
char
.
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.