C2 has the following built-in primitive types:
- bool. can be either true or false
- int8, int16, int32, int64. The signed types
- uint8, uint16, uint32, uint64. The unsigned types
- float32, float64. Floating point types
There is also a builtin void type, used for pointers (eg void*) For convenience, the char keyword is also available and is identical to the int8 type.
Note that C2 does not have any type specifiers like signed, unsigned, long, short, etc.
The c2compiler always has a pseudo module called c2. This module is used to store some language symbols such as min/max values and things like build time, etc. For each integer type there exists a min/max value:
- min_int8, max_int8
- min_int16, max_int16
- min_int32, max_int32
- min_int64, max_int64
- min_uint8, max_uint8
- min_uint16, max_uint16
- min_uint32, max_uint32
- min_uint64, max_uint64
module foo; import c2; int32 highest = c2.max_int32;
It also includes some C type for mapping C declarations in libraries to C2 interface types. See External Libraries for more information.
Pointer types are created by adding an asterix (*) after the type they refer to, like
void* a; int8* b; Point* c; char**
Arrays in C2 differ from C arrays in that the  always come right after the element type, so
void* a; Point b;
For array types, C2 introduces a new operator, namely elemsof(). This returns the number of elements in an array and avoids C macros like:
#define ARRAY_SIZE(x) ( sizeof(x) / sizeof(x) )
The sizeof() operator is also still available.