MPLAB IDE data type sizes

srinath reddy picture srinath reddy · Nov 10, 2009 · Viewed 27.1k times · Source

In MPLAB IDE what is the sizes of data types (int, unsigned int, float, unsigned float, char...)?

Answer

unwind picture unwind · Nov 10, 2009

This is hard without knowing for which CPU you want to compile code. Assuming e.g. Microchip's C18 compiler for the PIC18, the User Guide states the following fundamental type sizes:

TYPE                SIZE     RANGE
char(1,2)            8 bits  -128 127
signed char          8 bits  -128 127
unsigned char        8 bits  0 255
int                 16 bits  -32,768 32,767
unsigned int        16 bits  0 65,535
short               16 bits  -32,768 32,767
unsigned short      16 bits  0 65,535
short long          24 bits  -8,388,608 8,388,607
unsigned short long 24 bits  0 16,777,215
long                32 bits  -2,147,483,648 2,147,483,647
unsigned long       32 bits  0 4,294,967,295

Note that this includes some types (short long) that are not standard in C.