HP C A.06.05 Reference Manual

Program Organization
Constants
Chapter 224
Constants
There are four types of constants in C:
Integer Constants
Floating-Point Constants
Character Constants
String Constants
Every constant has two properties: value and type. For example, the constant 15 has value
15 and type int.
Integer Constants
HP C supports three forms of integer constants:
decimal One or more digits from 0-9. The constant must not start with a 0.
octal One or more digits from 0-7. The constant must begin with 0.
hexadecimal One or more hexadecimal digits from 0-9, a-f, or A-F. The constant must
begin with 0x or 0X.
An integer constant is a simple number like 12. It is not an integer variable (like x or y)oran
integer expression.
The data type assigned to an integer constant is the first in which it will fit from the list on
the right for the constant declaration on the left:
Table 2-3 Convention Summary
Constant Assigned Data Type
decimal (no suffix) int, long int, unsigned long int
octal or hex (no suffix) int, unsigned int, long, unsigned long
letter u or U suffix unsigned int, unsigned long int
letter l or L suffix long, unsigned long
both letters u or U and unsigned long l or L suffix
letters ll or LL suffix: long long, unsigned long long