1.2.5 Constants

The types of constant are integer, string, Boolean, and double.
Integer constants
Integer constants can be in decimal, hexadecimal, octal and binary format:
  • Octal constants begin with a leading 0.
  • Hexadecimal constants begin with the prefix 0x or 0X.
  • Binary numbers begin with the prefix 0b or 0B.
  • All other numbers are treated as decimal constants. Suffixes like U or L are permitted but are ignored.
String constants
String constants are surrounded by double quotes. Special escape sequences that begin with a backslash \ can be used to include control characters into a string. To put a backslash into a string a double backslash \\ must be used.
Characters can also be specified using octal or hexadecimal ASCII code.

Table 1-3 Escape characters for string constants

Name Escape sequence
Newline \n
Horizontal tab \t
Vertical tab \v
Backspace \b
Carriage return \r
Form feed \f
Alert \a
Backslash \\
Question mark \?
Single quote \'
Double quote \"
Character by octal ASCII code ooo \ooo
Character by hexadecimal ASCII code hh \xhh
Boolean constants
The Boolean constants are true and false.
Double constants
A double is a floating-point number represented with 64 bits. For example: 3.14, 5.4E14, or 3E-7.
Non-ConfidentialPDF file icon PDF versionARM DUI0840C
Copyright © 2014, 2015 ARM. All rights reserved.