Mercurial > projects > dang
changeset 73:9f66771fb1a3 new_gen
Forgot a test file for arrays...
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Thu, 01 May 2008 23:09:27 +0200 |
parents | 628cb46ab13b |
children | 192da4976daa |
files | tests/code/array_1.d |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/array_1.d Thu May 01 23:09:27 2008 +0200 @@ -0,0 +1,22 @@ + +struct Array +{ + int[] data; + int length +} + +void insert(Array a, int v) +{ + a.length = a.length + 1; + a.data[a.length - 1] = v; +} + +int main() +{ + array a; + a.length = 0; + + insert(a, 5); + + return a.data[0] +}