Files
lib_compiler/tests/arrays.txt
2024-04-13 15:29:53 +02:00

25 lines
483 B
Plaintext

import "libc";
p :: proc(a: [100]int @unused) {
}
vv: [10]int = {[5] = 4};
str := :[]*char{"A", "B", "CD"};
#static_assert(1 == 1);
main :: proc(): int {
v: [100]int = {1,2};
#static_assert(typeof(v) == typeof(:[100]int));
assert(v[0] == 1);
assert(v[1] == 2);
assert(vv[5] == 4);
assert(vv[6] == 0);
p(v); // disallow?
assert(str[0][0] == 'A');
p0: *int = &v[0];
p1 := &v[0];
#static_assert(typeof(p0) == typeof(p1));
return 0;
}