字符类型Character Types

前面没有字母 L 的整数字符常量具有类型 intAn integer character constant not preceded by the letter L has type int. 包含单个字符的整数字符常量的值是解释为整数的字符的数字值。The value of an integer character constant containing a single character is the numerical value of the character interpreted as an integer. 例如,字符 a 的数字值在十进制和十六进制下分别为 97 和 61。For example, the numerical value of the character a is 97 in decimal and 61 in hexadecimal.

从语法上来说,“宽字符常量”是带有字母 L 前缀的字符常量。宽字符常量具有类型 wchar_t(在 STDDEF.H 头文件中定义的整型)。Syntactically, a "wide-character constant" is a character constant prefixed by the letter L. A wide-character constant has type wchar_t, an integer type defined in the STDDEF.H header file. 例如: For example:

char    schar =  'x';   /* A character constant          */  
wchar_t wchar = L'x';   /* A wide-character constant for   
                            the same character           */  

宽字符常量的宽度为 16 位,用于指定扩展执行字符集的成员。Wide-character constants are 16 bits wide and specify members of the extended execution character set. 它们允许您用字母表示因太大而无法用类型 char 表示的字符。They allow you to express characters in alphabets that are too large to be represented by type char. 有关宽字符的详细信息,请参阅多字节和宽字符See Multibyte and Wide Characters for more information about wide characters.

另请参阅See Also

C 字符常量C Character Constants