mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
array of pointers support
This commit is contained in:
parent
f00f9fbf5a
commit
67cf7f18e6
5 changed files with 27 additions and 15 deletions
|
@ -3,6 +3,19 @@ const (
|
|||
A = 8
|
||||
)
|
||||
|
||||
fn test_pointer() {
|
||||
mut arr := []*int
|
||||
a := 1
|
||||
b := 2
|
||||
c := 3
|
||||
arr << &a
|
||||
arr << &b
|
||||
arr << &c
|
||||
assert *arr[0] == 1
|
||||
arr[1] = &c
|
||||
assert *arr[1] == 3
|
||||
}
|
||||
|
||||
fn test_ints() {
|
||||
mut a := [1, 5, 2, 3]
|
||||
assert a.len == 4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue