0

The character constants are defined in c11 as:
Syntax
  character-constant:
   ' c-char-sequence '
   L' c-char-sequence '
   u' c-char-sequence '
   U' c-char-sequence '
  c-char-sequence:
   c-char
   c-char-sequence c-char
  c-char:
   any member of the source character set except the single-quote ', backslash \, or new-line character
   escape-sequence

It is defined recursively, so inside the single-quotes, there are one or more c-chars, like 'abc'.
However as I know, a character constant contains only one c-char, like 'a', doesn't it?

YuuY
  • 107
  • 8
  • Characters are UTF-8 as far as I know. It can support characters beyond what ASCII can. See here http://stackoverflow.com/questions/10229156/how-many-characters-can-utf-8-encode – Dustin Nieffenegger Apr 19 '17 at 01:24
  • The Macintosh File System used four bytes constants for file types and file application creator, like `'TEXT'` for a text file, `'APPL'` for an application. File name extensions were rarely used (mostly used for programming and web publishing). – curiousguy Jul 02 '18 at 06:37

1 Answers1

0

as I know, a character constant contains only one c-char, like 'a', doesn't it?

no, 'abcd' is also a character constant. Its value is technically implementation-defined, but everywhere I've looked it was formed out of the values of the chars, in big-endian order (in that case, 0x61626364)

The C side of cppreference has a discussion of various character constants

Cubbi
  • 46,567
  • 13
  • 103
  • 169