Chapter 8 Writing Source Statements

8.4Character Constants

ASCII characters ,which can be displayed, can be coded as character constants or string constants. The characters that can be used for constants are as follows.

Digits

Letters (upper or lower cases)

Blank letters

Special characters

NOTE:

“\” letters make the following letters valid.

 

 

Example: ‘\”, ‘\\’, “\””, “\\”

 

 

 

Character constants

A character constant is stored as an ASCII code in the space of a single character. The method for specifying character constants differs depending on the coding format.

The coding format is selected using the notation directive. The default is extended C language format.

NOTE:

The coding format also applies to numbers. Refer to section 8.3, "Numbers", for

 

 

details.

 

 

 

Coding rules:

In extended C format and Intel format, character constants are specified just with the character enclosed in single quotation marks ( ' ). In Matsushita format, the enclosed character is preceded by the letter 'C' (or 'c').

The character 'A' (ASCII code 042) is specified in each coding format as follows.

Coding Format

Character Constant

 

 

Extended C language format

‘A’

Matsushita format

C’A’ or c’A’

Intel format

‘A’

Specifying more than one character (such as C’FEDCBA’ or ’FEDCBA’) will cause an error.

NOTE:

To specify a single quotation mark or a backslash for a character constant, a

 

 

backslash (\) precedes the character.

 

 

 

Character Constants 133

Page 145
Image 145
Panasonic MN1030 user manual Character Constants, Character constants