111
|
1 struct foo
|
|
2 {
|
|
3 int a, b, c, d;
|
|
4 double doubl;
|
|
5 } s1, s2;
|
|
6
|
|
7 #ifndef ONLY2
|
|
8
|
|
9 struct foo
|
|
10 structret (s1, i1, i2, s2)
|
|
11 struct foo s1, s2;
|
|
12 int i1, i2;
|
|
13 {
|
|
14 if (i1 != i2)
|
|
15 {
|
|
16 if (i1 < i2)
|
|
17 return s1;
|
|
18 else
|
|
19 return s2;
|
|
20 }
|
|
21 s2.a = 11;
|
|
22 s2.b = 22;
|
|
23 s2.c = s1.c;
|
|
24 s2.d = s1.d;
|
|
25 return s2;
|
|
26 }
|
|
27
|
|
28 #endif
|
|
29
|
|
30 #ifndef ONLY1
|
|
31
|
|
32 struct foo
|
|
33 mani (a, b)
|
|
34 {
|
|
35 return structret (s1, a, b, s2);
|
|
36 }
|
|
37
|
|
38 init ()
|
|
39 {
|
|
40 s1.a = 1;
|
|
41 s1.b = 2;
|
|
42 s1.c = 3;
|
|
43 s1.d = 4;
|
|
44 s1.doubl = 3.1415;
|
|
45 s2.a = -1;
|
|
46 s2.b = -2;
|
|
47 s2.c = -3;
|
|
48 s2.d = -4;
|
|
49 s2.doubl = 2.71818;
|
|
50 }
|
|
51
|
|
52 main ()
|
|
53 {
|
|
54 struct foo s;
|
|
55
|
|
56 init ();
|
|
57 s = mani (1, 1);
|
|
58 printf ("%d, %d, %d, %d : %f\n", s.a, s.b, s.c, s.d, s.doubl);
|
|
59
|
|
60 init ();
|
|
61 s = mani (2, 1);
|
|
62 printf ("%d, %d, %d, %d : %f\n", s.a, s.b, s.c, s.d, s.doubl);
|
|
63
|
|
64 init ();
|
|
65 s = mani (1, 2);
|
|
66 printf ("%d, %d, %d, %d : %f\n", s.a, s.b, s.c, s.d, s.doubl);
|
|
67 }
|
|
68
|
|
69 #endif
|