Primitive Types
The following types are inherited unchanged from C11. Their sizes, signedness, and semantics are identical to what you already know.| Type | Size | Description |
|---|---|---|
int | 4 bytes | Signed 32-bit integer |
unsigned int | 4 bytes | Unsigned 32-bit integer |
short | 2 bytes | Signed 16-bit integer |
long | 8 bytes | Signed 64-bit integer |
char | 1 byte | Single byte / ASCII character |
float | 4 bytes | Single-precision floating-point |
double | 8 bytes | Double-precision floating-point |
void | — | No type / no return value |
Pointers
C△ supports standard C-style pointers with the same* and & syntax you already know from C11. No new syntax is introduced.
C△‘s
autoremove allocate feature is designed to manage heap-allocated pointer lifetimes automatically. It is not yet implemented in the current compiler — see Compiler Status.string — First-Class String
string is a built-in, automatically memory-managed type for text. Unlike char*, you do not manage the underlying buffer yourself — the compiler handles allocation and deallocation.
auto — Type Inference
Declare a variable with auto and the compiler infers its type from the initializer. The type is resolved during the simulation pass and is fully type-aware at runtime — auto does not mean “untyped”.
auto declaration when they share the same initial value:
dynam — Dynamic Array
A dynam array is a typed, resizable array that grows and shrinks at runtime. You declare it with a bracketed initializer list and modify it with built-in methods.
dynam arrays have no fixed capacity. The runtime expands or contracts the backing allocation automatically — you never call realloc manually.tuple — Heterogeneous List
A tuple is a dynamically-sized list that holds values of mixed types. Access elements by zero-based index, append with .push(), and query length with len().
Struct Types
C△ provides two struct variants. Choose plain struct for data types that need constructors and methods but not polymorphism. Choosetyped struct when you need inheritance and want the type to be recognized natively by the compiler.
Plain Struct
Plain Struct
Plain structs support an The
init constructor lifecycle, an end destructor lifecycle, and member functions. They do not support inheritance.self keyword gives member functions access to the struct’s own fields. It is optional but recommended for clarity when field names shadow parameter names.Typed Struct — Inheritance
Typed Struct — Inheritance
A Multiple inheritance chains additional parents left to right. Constructors execute in declaration order (left to right). When two parents define the same method name, qualify the call with the parent struct name to resolve the conflict:
typed struct becomes a native type in the compiler and supports single and multiple inheritance. Declare parent types with &ParentName immediately after the struct name.Type Format Specifiers
Use these specifiers withprintd and other formatted-output functions to match each C△ type to its correct format token. The %k specifier is unique to C△ and handles auto variables whose concrete type is only known at runtime.
| Specifier | Type |
|---|---|
%d | int |
%ld | long |
%lld | long long |
%u | unsigned |
%o | octal |
%x / %X | hex (lowercase / uppercase) |
%p | pointer |
%f | float / double |
%s | string / char* |
%c | char |
%k | auto (dynamic type — resolved at runtime) |
