A character literal is a type of literal in programming for the representation of a single character's value within the source code of a computer program.
Languages that have a dedicated character data type generally include character literals; these include C, C++, Java,[1] and Visual Basic.[2] Languages without character data types (like Python[3] or PHP[4]) will typically use strings of length 1 to serve the same purpose a character data type would fulfil. This simplifies the implementation and basic usage of a language but also introduces new scope for programming errors.
A common convention for expressing a character literal is to use a single quote (') for character literals, as contrasted by the use of a double quote (") for string literals. For example, 'a' indicates the single character a while "a" indicates the string a of length 1.
The representation of a character within the computer memory, in storage, and in data transmission, is dependent on a particular character encoding scheme. For example, an ASCII (or extended ASCII) scheme will use a single byte of computer memory, while a UTF-8 scheme will use one or more bytes, depending on the particular character being encoded.
Alternative ways to encode character values include specifying an integer value for a code point, such as an ASCII code value or a Unicode code point. This may be done directly via converting an integer literal to a character, or via an escape sequence.
^"Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)". docs.oracle.com. Retrieved 2016-09-24.
^"Data Type Summary (Visual Basic)". msdn.microsoft.com. Retrieved 2016-09-24.
A characterliteral is a type of literal in programming for the representation of a single character's value within the source code of a computer program...
commonly use a quoted sequence of characters, formally "bracketed delimiters", as in x = "foo", where "foo" is a string literal with value foo. Methods such...
field of a record or tuple); also, # prefixes a string literal to turn it into a characterliteral. In Mathematica syntax, #, when used as a variable, becomes...
text in a character or string literal that represents one or more other characters to the compiler. It allows a programmer to specify characters that are...
wildcard character is a kind of placeholder represented by a single character, such as an asterisk (*), which can be interpreted as a number of literal characters...
Like string literals, character constants can also be modified by prefixes, for example L'A' has type wchar_t and represents the character value of "A"...
Java, C#, and Scala) uses apostrophes to delimit a characterliteral. In these languages a character is a different object than a one-letter string. In...
data type std_ulogic (standard unresolved logic) consists of nine characterliterals (see table on the right). This system promoted a useful set of logic...
Literal and figurative language is a distinction within some fields of language analysis, in particular stylistics, rhetoric, and semantics. Literal language...
embedded in an XML literal, the application creates a LINQ-to-XML object for each literal at run time. String literalCharacterliteral ECMAScript for XML...
science, an escape sequence is a combination of characters that has a meaning other than the literalcharacters contained therein; it is marked by one or more...
as a string. Many C compilers, including GCC, define a multi-character literal behavior of right-aligning to the least significant byte, so that '1234'...
special meaning, or a regular character that has a literal meaning. For example, in the regex b., 'b' is a literalcharacter that matches just 'b', while...
Character amnesia is a phenomenon where experienced speakers of some East Asian languages forget how to write Chinese characters previously well-known...
the string literal – at the syntactic level "1" is simply a string, no different from "foo". Recognizing a string (sequence of characters in the source...
wide-character string literal. A lexeme, however, is only a string of characters known to be of a certain kind (e.g., a string literal, a sequence of letters)...
0, called the null character, shall exist in the basic execution character set; it is used to terminate a character string literal." — ANSI/ISO 9899:1990...
languages specify the double-quote character (") as a delimiter for a string literal. The backslash (\) escape character typically provides two ways to include...
to escape characters, except they usually consist of some kind of mnemonic instead of just a single character. One use is in string literals that include...
characteristics on an otherwise human body. They are not individuals who are literal cats but individuals who only look superficially feline. Catgirls are found...
supported language. In Erlang, the dollar sign precedes characterliterals. The dollar sign as a character can be written $$. In COBOL the $ sign is used in...
A literal music video, also called a literal video version, is a satirical remix of an official music video clip in which the lyrics have been replaced...