/
ex22_main.c
52 lines (34 loc) · 1.06 KB
/
ex22_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
#include "ex22.h"
#include "debug.h"
const char *MY_NAME = "Zed A. Shaw";
void scope_demo(int count){
log_info("count is :%d", count);
if(count > 10){
int count = 100; //Bad bug
log_info("count in this scope is %d", count);
}
log_info("count is at exit: %d", count);
count = 3000;
log_info("count after assign: %d", count);
}
int main(int argc, char *argv[])
{
log_info("my name: %s, age: %d", MY_NAME, get_age());
set_age(100);
log_info("my age is now: %d", get_age());
// test ou thte SIZE_EXTERN
log_info("THE_SIZE is: %d", THE_SIZE);
print_size();
log_info("Ratio at first: %f", *update_ratio(2.0));
log_info("Ratio again: %f", *update_ratio(10));
log_info("Ratio once more: %f", *update_ratio(300.0));
int count = 4;
scope_demo(count);
scope_demo(count * 20);
log_info("count after calling scope_demo: %d", count);
double *static_ratio = update_ratio(0.5);
log_info("reaching in to the static ratio: %f", *static_ratio);
*static_ratio = .001;
log_info("changed the static ration in to the static ratio: %f", *static_ratio);
return 0;
}