Mercurial > hg > CbC > CbC_gcc
comparison CbC-examples/rectype/struct.cbc @ 109:78d3881f2882
add CbC-example/rectype
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 14 Jun 2012 20:43:12 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
108:7ad14f446135 | 109:78d3881f2882 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 struct interface { | |
4 __code (*next)(struct interface); | |
5 }; | |
6 | |
7 __code print(struct interface p) | |
8 { | |
9 printf("print\n"); | |
10 exit(0); | |
11 } | |
12 __code csA(struct interface p) | |
13 { | |
14 struct interface ds; | |
15 ds.next = csA; | |
16 goto p.next(ds); | |
17 } | |
18 | |
19 void main1() | |
20 { | |
21 struct interface ds; | |
22 ds.next = print; | |
23 goto csA(ds); | |
24 } | |
25 | |
26 int main() | |
27 { | |
28 main1(); | |
29 return 0; | |
30 } |