Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 48

Advertising
background image

Otherwise:

If the constant has a

U

or

u

suffix, its data type will be the first of the following

that can accommodate its value:

unsigned short

,

unsigned int

,

unsigned

long int

.

If the constant has an

L

or

l

suffix, its data type will be the first of the following

that can accommodate its value:

long int

,

unsigned long int

.

If the constant has both

U

and

L

suffixes, (

ul

,

lu

,

Ul

,

lU

,

uL

,

Lu

,

LU

, or

UL

), its

data type will be

unsigned long int

.

Decimal Constants

Decimal constants from -2147483648 to 4294967295 are allowed. Constants
exceeding these bounds will produce an “Out of range” error. Decimal constants
must not use an initial zero. An integer constant that has an initial zero is interpret-
ed as an octal constant.

In the absence of any overriding suffixes, the data type of a decimal constant is
derived from its value, as shown below:

< -2147483648

Error: Out of range!

-2147483648 .. -32769

long

-32768 .. -129

int

-128 .. 127

short

128 .. 255

unsigned short

256 .. 32767

int

32768 .. 65535

unsigned int

65536 .. 2147483647

long

2147483648 .. 4294967295

unsigned long

> 4294967295

Error: Out of range!

Hexadecimal Constants

All constants starting with

0x

(or

0X

) are taken to be hexadecimal. In the absence

of any overriding suffixes, the data type of an hexadecimal constant is derived
from its value, according to the rules presented above. For example,

0xC367

will

be treated as

unsigned int

.

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

40

MikroElektronika: Development tools - Books - Compilers

page

Advertising
This manual is related to the following products: