// growable arrays and fixed ones struct point { int x, y; }; fn main() { let before = live_objects(); { []int a = new([]int); for (int i = 0; i < 100; i++) push(a, i * i); putn(len(a)); putc(' '); putn(cap(a)); putc(' '); putn(a[99]); putc(' '); putn(pop(a)); putc(' '); putn(len(a)); putc(' '); resize(a, 3); putn(len(a)); putc(' '); putn(a[2]); putc(' '); fixed []int f = new(fixed []int, 5); f[4] = 7; putn(f[4] + len(f)); putc(' '); []point ps = new([]point, 2); ps[1].y = 9; resize(ps, 10); putn(ps[1].y + len(ps)); putc(' '); [8]int st; putn(len(st)); putc(' '); []*point owned = new([]*point); for (int i = 0; i < 20; i++) { *point p = new(point); p.x = i; push(owned, d*p); } putn(owned[19].x); putc(' '); putn(live_objects() - before); putc(10); } putn(live_objects() - before); putc(10); return 0; }