holey-bytes/hblang/examples/pointers.hb

18 lines
204 B
Plaintext
Raw Normal View History

2024-05-12 04:52:58 -05:00
main := fn(): int {
a := 1;
b := &a;
2024-05-12 15:40:28 -05:00
modify(b);
2024-05-14 07:01:40 -05:00
drop(a);
stack_reclamation_edge_case := 0;
return *b - 2;
2024-05-12 04:52:58 -05:00
}
2024-05-12 15:40:28 -05:00
modify := fn(a: *int): void {
*a = 2;
return;
}
2024-05-14 07:01:40 -05:00
drop := fn(a: int): void {
return;
}