4.3.2 Integer Data Types

The MPLAB XC8 compiler supports integer data types with 1, 2, 4 and 8 byte sizes. Tabulated below are the supported data types and their corresponding size and arithmetic type.

Table 4-1. Integer Data Types
Type Size (bits) Arithmetic Type
signed char 8 Signed integer
unsigned char 8 Unsigned integer
signed short 16 Signed integer
unsigned short 16 Unsigned integer
signed int 16 Signed integer
unsigned int 16 Unsigned integer
signed long 32 Signed integer
unsigned long 32 Unsigned integer
signed long long 64 Signed integer
unsigned long long 64 Unsigned integer

If no type signedness is specified (including char types), then that type is signed.

All integer values are represented in little endian format with the Least Significant Byte (LSB) at the lower address in the device memory.

Signed values are stored as a two’s complement integer value.

The range of values capable of being held by these types is summarized in the declarations for <limits.h>, contained in the Microchip Unified Standard Library Reference Guide. The symbols presented there are preprocessor macros that are available after including <limits.h> in your source code. As the size of data types are not fully specified by the C Standard, these macros allow for more portable code which can check the limits of the range of values held by the type on this implementation.

Macros are also available in <stdint.h> which define values associated with fixed-width types, such as int8_t, uint32_t etc.