Keil Logo

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 Type Bits Bytes Value Range
Bit 1 0 to 1
signed char 8 1 -128 to +127
unsigned char 8 1 0 to 255
Enum 8 / 16 1 or 2 -128 to +127 or -32768 to +32767
signed short 16 2 -32768 to +32767
unsigned short 16 2 0 to 65535
signed int 16 2 -32768 to +32767
unsigned int 16 2 0 to 65535
signed long 32 4 -2147483648 to 2147483647
unsigned long 32 4 0 to 4294967295
Float 32 4 ±1.175494E-38 to ±3.402823E+38
data *, idata *, pdata * 8 1 0x00 to 0xFF
code*, xdata * 16 2 0x0000 to 0xFFFF
generic pointer 24 3 Memory 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.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.