next up previous
Next: Operations that involve values Up: Unit 04 Previous: Explicit type conversion (casting)

The primitive data type char

Strings are constituted by single characters, which are values of type char. A variable of type char can contain just a single character. The domain of the type char is constituted by the more than 64000 characters of the Unicode standard. The Unicode standard establishes a correspondence between numbers and symbols that can be either alphabetical, numerical, or special symbols in various languages (including the Asiatic ones). For example, the character 'A' corresponds to the numeric code 65., the character 'B' to the numeric code 66, etc. For more details on the Unicode standard, you can consult the website http://www.unicode.org/.

Literals of type char can be denoted in various ways; the simplest one is through single quotes.

Example:

char c = 'A';  char c = '0';


next up previous
Next: Operations that involve values Up: Unit 04 Previous: Explicit type conversion (casting)