Types, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 67

Advertising
background image

C is strictly typed language, which means that every object, function, and expres-
sion need to have a strictly defined type, known in the time of compilation. Note
that C works exclusively with numeric types.

The type serves:

- to determine the correct memory allocation required initially,
- to interpret the bit patterns found in the object during subsequent accesses,
- in many type-checking situations, to ensure that illegal assignments are trapped.

mikroC supports many standard (predefined) and user-defined data types, includ-
ing signed and unsigned integers in various sizes, floating-point numbers in vari-
ous precisions, arrays, structures, and unions. In addition, pointers to most of these
objects can be established and manipulated in memory.

The type determines how much memory is allocated to an object and how the pro-
gram will interpret the bit patterns found in the object’s storage allocation. A given
data type can be viewed as a set of values (often implementation-dependent) that
identifiers of that type can assume, together with a set of operations allowed on
those values. The compile-time operator,

sizeof

, lets you determine the size in

bytes of any standard or user-defined type.

The mikroC standard libraries and your own program and header files must pro-
vide unambiguous identifiers (or expressions derived from them) and types so that
mikroC can consistently access, interpret, and (possibly) change the bit patterns in
memory corresponding to each active object in your program.

Type Categories

The fudamental types represent types that cannot be separated into smaller parts.
They are sometimes referred to as unstructured types. The fundamental types are

void

,

char

,

int

,

float

, and

double

, together with

short

,

long

,

signed

, and

unsigned

variants of some of these.

The derived types are also known as structured types. The derived types include
pointers to other types, arrays of other types, function types, structures, and
unions.

MikroElektronika: Development tools - Books - Compilers

59

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

TYPES

Advertising
This manual is related to the following products: