Arithmetic Types

The arithmetic type specifiers are built up from the following keywords: void, char, int, float and double, together with the prefixes short, long, signed and unsigned. From these keywords you can build both integral and floating-point types.

Integral Types

The types char and int, together with their variants, are considered to be integral data types. Variants are created by using one of the prefix modifiers short, long, signed and unsigned.

In the table below is an overview of the integral types – keywords in parentheses can be (and often are) omitted.

The modifiers signed and unsigned can be applied to both char and int. In the absence of the unsigned prefix, signed is automatically assumed for integral types. The only exception is char, which is unsigned by default. The keywords signed and unsigned, when used on their own, mean signed int and unsigned int, respectively.

The modifiers short and long can only be applied to int. The keywords short and long, used on their own, mean short int and long int, respectively.

Type Size in bytes Range
bit 1–bit 0 or 1
sbit 1–bit 0 or 1
(unsigned) char 1 0 .. 255
signed char 1 - 128 .. 127
(signed) short (int) 1 - 128 .. 127
unsigned short (int) 1 0 .. 255
(signed) int 2 -32768 .. 32767
unsigned (int) 2 0 .. 65535
(signed) long (int) 4 -2147483648 .. 2147483647
unsigned long (int) 4 0 .. 4294967295

Floating-point Types

The types float and double, together with the long double variant, are considered to be floating-point types. The mikroC PRO for PIC’s implementation of an ANSI Standard considers all three to be the same type.

Floating point in the mikroC PRO for PIC is implemented using the Microchip AN575 32-bit format (IEEE 754 compliant).

An overview of the floating-point types is shown in the table below:

Type Size in bytes Range
float 4 -1.5 * 1045 .. +3.4 * 1038
double 4 -1.5 * 1045 .. +3.4 * 1038
long double 4 -1.5 * 1045 .. +3.4 * 1038
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code