C 的 char 类型使用什么字符集? [英] What character set does C's char type use?

查看:42
本文介绍了C 的 char 类型使用什么字符集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我的愚蠢问题.但我想知道 C 的 char 类型使用什么字符集.起初我以为是 ASCII,但后来我意识到它可以达到 255,超过了 ASCII 的 127 个字符.这是什么字符集?扩展ASCII?

Forgive me for the stupid question. But I was wondering what character set C's char type uses. At first I thought it was ASCII, but then I realized it could reach 255 which exceeds ASCII's 127 characters. What character set is this? Extended ASCII?

推荐答案

C 标准不要求 C 实现使用特定的字符集.它要求执行字符集(用于运行程序,与编译时使用的源字符集相反)具有拉丁字母 A-Z 和 a-z,数字 0-9,这些字符:

The C standard does not require C implementations to use a particular character set. It requires the execution character set (used in running programs, in contrast to the source character set used when compiling) to have the Latin alphabet letters A-Z and a-z, the digits 0-9, these characters:

!"#%&’()*+,-./:;?[]^_{|}~

空格字符,以及用于水平制表符、垂直制表符、换页、警告、退格、回车和换行符的字符.它要求数字的代码从 0 的代码到 9 的代码是连续的,并且必须有字符值 0 来标记字符串的结尾.否则,它将字符集留给每个 C 实现.

the space character, and characters for horizontal tab, vertical tab, form feed, alert, backspace, carriage return, and new line. It requires the codes for the digits to be consecutive from the code for 0 to the code for 9, and the character value zero must be available to mark the end of strings. Otherwise, it leaves the character set up to each C implementation.

C 实现绝大多数使用字符代码为 0-127 的 ASCII.使用代码 128-255 的实现可能会有更多变化.

C implementations overwhelmingly use ASCII with the character codes 0-127. There may be somewhat more variation in what implementations use with codes 128-255.

这篇关于C 的 char 类型使用什么字符集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆