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 char8Signed integer
unsigned char8Unsigned integer
signed short16Signed integer
unsigned short16Unsigned integer
signed int16Signed integer
unsigned int16Unsigned integer
signed long32Signed integer
unsigned long32Unsigned integer
signed long long64Signed integer
unsigned long long64Unsigned 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.