Init new repository
This commit is contained in:
25
tests/arrays.txt
Normal file
25
tests/arrays.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user