mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
19 lines
324 B
Plaintext
19 lines
324 B
Plaintext
struct Node
|
|
{
|
|
int i;
|
|
}
|
|
|
|
struct MyList
|
|
{
|
|
Node** entries;
|
|
}
|
|
fn Node* MyList.get(&self, usz index) @operator([]) => self.entries[index];
|
|
fn Node** MyList.get_ref(&self, usz index) @operator(&[]) => &self.entries[index];
|
|
fn int main()
|
|
{
|
|
Node n;
|
|
Node* np = &n;
|
|
MyList list = {.entries = &np};
|
|
list[0].i = 5;
|
|
return 0;
|
|
} |