Keil™, An ARM® Company

Cx51 User's Guide

Data Storage Formats

This section describes the storage formats of the data types available in the Cx51 compiler. The Cx51 compiler offers a number of basic data types to use in your C programs. The following table lists these data types along with their size requirements and value ranges.

Data TypeBitsBytesValue Range
Bit10 to 1
signed char81-128 to +127
unsigned char810 to 255
Enum8 / 161 or 2-128 to +127 or -32768 to +32767
signed short162-32768 to +32767
unsigned short1620 to 65535
signed int162-32768 to +32767
unsigned int1620 to 65535
signed long324-2147483648 to 2147483647
unsigned long3240 to 4294967295
Float324±1.175494E-38 to ±3.402823E+38
data *, idata *, pdata *810x00 to 0xFF
code*, xdata *1620x0000 to 0xFFFF
generic pointer243Memory type (1 byte); Offset (2 bytes) 0 to 0xFFFF

Other data types, like structures and unions, may contain scalars from this table. All elements of these data types are allocated sequentially and are byte-aligned due to the 8-bit architecture of the 8051 family.