Constants, Integer constants, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 47

Advertising
background image

Constants or literals are tokens representing fixed numeric or character values.

mikroC supports:

- integer constants,
- floating point constants,
- character constants,
- string constants (strings literals),
- enumeration constants.

The data type of a constant is deduced by the compiler using such clues as numer-
ic value and the format used in the source code.

Integer Constants

Integer constants can be decimal (base 10), hexadecimal (base 16), binary (base
2), or octal (base 8). In the absence of any overriding suffixes, the data type of an
integer constant is derived from its value.

Long and Unsigned Suffixes

The suffix

L

(or

l

) attached to any constant forces the constant to be represented

as a

long

. Similarly, the suffix

U

(or

u

) forces the constant to be

unsigned

. You

can use both

L

and

U

suffixes on the same constant in any order or case:

ul

,

Lu

,

UL

, etc.

In the absence of any suffix (

U

,

u

,

L

, or

l

), constant is assigned the “smallest” of

the following types that can accommodate its value:

short

,

unsigned short

,

int

,

unsigned int

,

long int

,

unsigned long int

.

MikroElektronika: Development tools - Books - Compilers

39

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

CONSTANTS

Advertising
This manual is related to the following products: