|
|
@ -31,6 +31,13 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
|
|
|
|
|
|
log_info("My age is now: %d", get_age());
|
|
|
|
log_info("My age is now: %d", get_age());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int new_age = 44;
|
|
|
|
|
|
|
|
log_info("Setting age directly to %d", new_age);
|
|
|
|
|
|
|
|
int *age = get_age_pointer();
|
|
|
|
|
|
|
|
*age = new_age;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log_info("My age is now: %d", get_age());
|
|
|
|
|
|
|
|
|
|
|
|
// test out THE_SIZE extern
|
|
|
|
// test out THE_SIZE extern
|
|
|
|
log_info("THE_SIZE is: %d", THE_SIZE);
|
|
|
|
log_info("THE_SIZE is: %d", THE_SIZE);
|
|
|
|
print_size();
|
|
|
|
print_size();
|
|
|
@ -45,6 +52,15 @@ int main(int argc, char *argv[])
|
|
|
|
log_info("Ratio again: %f", update_ratio(10.0));
|
|
|
|
log_info("Ratio again: %f", update_ratio(10.0));
|
|
|
|
log_info("Ratio once more: %f", update_ratio(300.0));
|
|
|
|
log_info("Ratio once more: %f", update_ratio(300.0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// accessing a function static
|
|
|
|
|
|
|
|
double *func_static_value = get_function_static(4.0);
|
|
|
|
|
|
|
|
log_info("get_function_static(4.0) = %.1f", *func_static_value);
|
|
|
|
|
|
|
|
double new_func_static_value = 8.0;
|
|
|
|
|
|
|
|
log_info("Setting the function static var directly to %.1f",
|
|
|
|
|
|
|
|
new_func_static_value);
|
|
|
|
|
|
|
|
*func_static_value = new_func_static_value;
|
|
|
|
|
|
|
|
log_info("get_function_static(4.0) = %.1f", *get_function_static(4.0));
|
|
|
|
|
|
|
|
|
|
|
|
// test the scope demo
|
|
|
|
// test the scope demo
|
|
|
|
int count = 4;
|
|
|
|
int count = 4;
|
|
|
|
scope_demo(count);
|
|
|
|
scope_demo(count);
|
|
|
|