-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
125 lines (111 loc) · 2.18 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <stdio.h>
void B(char *s, int two, int three);
//void (*Z)(char *, int, int) = B;
typedef void (*some_func_ptr_t)(char *, int, int);
some_func_ptr_t Z = B;
void D(char *s, int two, int three)
{
printf("D\n");
int i;
for(i = 0; i < 2; i++){
printf(" D loop iteration %d\n", i);
}
}
void C(char *s, int four, int five, int six)
{
printf("Args to C are:\n");
printf(" %s\n", s);
printf(" %d\n", four);
printf(" %d\n", five);
printf(" %d\n", six);
B("str arg to B (from C)", 22, 33);
}
void B(char *s, int two, int three)
{
printf("B\n");
int i;
for(i = 0; i < 2; i++){
printf(" B loop iteration %d\n", i);
}
}
void A(char *s, int one, int two, int three, int four)
{
printf("Args to A are:\n");
printf(" %s\n", s);
printf(" %d\n", one);
int i;
for(i = 0; i < 2; i++){
//B("str arg to B", 2, 3);
Z("some func ptr invocation", 4, 2);
}
C("str arg to C", 4, 5, 6);
}
void A3(char *s, int one, int two, int three, int four)
{
printf("Args to A are:\n");
printf(" %s\n", s);
printf(" %d\n", one);
int i;
for(i = 0; i < 2; i++){
B("str arg to B", 2, 3);
//Z("some func ptr invocation", 4, 2);
}
C("str arg to C", 4, 5, 6);
}
void A5(char *s, int one, int two, int three, int four)
{
printf("Args to A are:\n");
printf(" %s\n", s);
printf(" %d\n", one);
int i;
for(i = 0; i < 1; i++){
//B("str arg to B", 2, 3);
Z("some func ptr invocation", 4, 2);
}
}
int test_0(void)
{
printf("hello world\n");
return 0;
}
int test_1(void)
{
D("str arg to D", 22, 33);
return 0;
}
int test_2(void)
{
B("str arg to B", 22, 33);
return 0;
}
int test_3(void)
{
A3("str arg to A", 11, 101, 102, 105);
return 0;
}
int test_4(void)
{
Z("str arg to B (invoked via Z)", 22, 33);
return 0;
}
int test_5(void)
{
A5("str arg to A", 11, 101, 102, 105);
return 0;
}
int test_9(void)
{
A("str arg to A", 11, 101, 102, 105);
return 0;
}
int main(void)
{
//test_0();
//test_1();
//test_2();
//test_3();
//test_4();
//test_5();
test_9();
return 0;
}