16
|
1 #include<stdio.h>
|
|
2 #include<stdlib.h>
|
|
3
|
|
4 struct abc {
|
|
5 int a;
|
|
6 double b;
|
|
7 char c;
|
|
8 double *d;
|
|
9 };
|
|
10
|
|
11 struct def {
|
|
12 int d;
|
|
13 struct abc e;
|
|
14 struct abc *f;
|
|
15 };
|
|
16
|
|
17 void print_abc(struct abc a){
|
|
18 printf("\tstruct abc:\n");
|
|
19 printf("\ta=%d, b=%lf, c=%d, d=%p\n", a.a, a.b, a.c, a.d);
|
|
20 }
|
|
21 void print_def(struct def b){
|
|
22 printf("\tstruct def:\n");
|
|
23 printf("\td=%d, f=%p\n", b.d, b.f);
|
|
24 print_abc(b.e);
|
|
25 }
|
|
26
|
|
27 __code cs_exit(int a){
|
|
28 printf("cs_exit : a=%d.\n", a);
|
|
29 exit(a);
|
|
30 }
|
|
31
|
|
32 __code cs0(struct abc a, struct def b, int c){
|
|
33 printf("cs0 :\n");
|
|
34 printf("c=%d\n", c);
|
|
35 print_abc(a);
|
|
36 print_def(b);
|
|
37 goto cs_exit( c*a.a+b.e.c );
|
|
38 }
|
|
39
|
|
40
|
|
41 __code cs_goto(int c, struct abc a, struct def b){
|
|
42 printf("cs_goto :\n");
|
|
43 printf("c=%d\n", c);
|
|
44 print_abc(a);
|
|
45 print_def(b);
|
|
46 goto cs0(a, b, c);
|
|
47 }
|
|
48
|
|
49 int function(){
|
|
50 struct abc A;
|
|
51 struct def B;
|
|
52 A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad;
|
|
53 B.d = 30, B.f = 0xbf;
|
|
54 B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed;
|
|
55
|
|
56 printf("function :\n");
|
|
57 print_abc(A);
|
|
58 print_def(B);
|
|
59 //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d);
|
|
60 goto cs_goto(100, A, B);
|
|
61 return 0;
|
|
62 }
|
|
63
|
|
64 int main(int argc, char **argv){
|
|
65 struct abc A;
|
|
66 struct def B;
|
|
67 //int a=10, b=20, c=30, d=40, e=50, f=60, g=70;
|
|
68 A.a = 10, A.b = 20.02, A.c = '\0', A.d = 0xad;
|
|
69 B.d = 30, B.f = 0xbf;
|
|
70 B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = 0xed;
|
|
71
|
|
72 /*
|
|
73 printf("main :\n");
|
|
74 print_abc(A);
|
|
75 print_def(B);
|
|
76 //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d);
|
|
77 goto cs_goto(100, A, B);
|
|
78 */
|
|
79 function();
|
|
80 return 0;
|
|
81 }
|
|
82
|
|
83
|