SLAU131V October 2004 – February 2020
A character literal is a single character enclosed in single quotes. The characters are represented internally as 8-bit ASCII characters. Two consecutive single quotes are required to represent each single quote that is part of a character literal. A character literal consisting only of two single quotes is valid and is assigned the value 0. These are examples of valid character literals:
'a' | Defines the character literal a and is represented internally as 6116 |
'C' | Defines the character literal C and is represented internally as 4316 |
'''' | Defines the character literal ' and is represented internally as 2716 |
'' | Defines a null character and is represented internally as 0016 |
Notice the difference between character literals and character string literals (Section 4.7.2 discusses character strings). A character literal represents a single integer value; a string is a sequence of characters. |