comparison tests/mini/arrays15.d @ 341:1bb99290e03a trunk

[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author lindquist
date Sun, 13 Jul 2008 02:51:19 +0200
parents test/arrays15.d@0baca2feb554
children
comparison
equal deleted inserted replaced
340:351c0077d0b3 341:1bb99290e03a
1 module arrays15;
2
3 extern(C) int printf(char*, ...);
4
5 void integer()
6 {
7 auto arr = new int[16];
8 arr[1] = 42;
9 arr[6] = 555;
10 print_int(arr);
11 delete arr;
12 }
13
14 void floating()
15 {
16 auto arr = new float[6];
17 arr[1] = 3.14159265;
18 arr[3] = 1.61803399;
19 print_float(arr);
20 delete arr;
21 }
22
23 void print_int(int[] arr)
24 {
25 printf("arr[%lu] = [", arr.length);
26 for (auto i=0; i<arr.length; i++)
27 printf("%d,", arr[i]);
28 printf("\b]\n");
29 }
30
31 void print_float(float[] arr)
32 {
33 printf("arr[%lu] = [", arr.length);
34 for (auto i=0; i<arr.length; i++)
35 printf("%f,", arr[i]);
36 printf("\b]\n");
37 }
38
39 void main()
40 {
41 integer();
42 floating();
43 }