What character set does C's char type use?

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?

1 answer

  • answered 2021-10-20 23:50 Eric Postpischil

    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:

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

    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 implementations overwhelmingly use ASCII with the character codes 0-127. There may be somewhat more variation in what implementations use with codes 128-255.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum