Mercurial > lcfOS
annotate test/c3examples/types.c3 @ 284:05184b95fa16
Moved tests to seperate folder
author | Windel Bouwman |
---|---|
date | Fri, 15 Nov 2013 13:43:22 +0100 |
parents | python/c3/examples/types.c3@81752b0f85a5 |
children | d9df72971cbf |
rev | line source |
---|---|
237 | 1 |
2 /* | |
3 Demo of how to define types | |
4 */ | |
5 | |
6 package typedemo; | |
7 | |
8 type int A; | |
9 type int B; | |
10 type struct { | |
11 int x, y; | |
12 A z; | |
13 } C; | |
14 type struct { | |
15 C x; | |
16 B y; | |
17 int z; | |
18 } D; | |
19 | |
20 type D* E; | |
21 | |
22 function int testcast() | |
23 { | |
24 var A a; | |
25 var B b; | |
26 a = 3; | |
27 b = a; | |
28 var C c; | |
29 c.x = a; | |
30 c.z = c.y; | |
31 var D d; | |
32 var E e; | |
33 var D* e2; | |
34 e = &d; | |
35 e2 = e; | |
36 e2->x.x = 22; | |
37 | |
38 return 0; | |
39 } | |
40 |