box-o-sand/oldstuff/lcthw-remnants/ex22.c

53 lines
614 B
C
Raw Normal View History

2011-11-02 01:56:34 +00:00
#include <stdio.h>
#include "ex22.h"
#include "dbg.h"
int THE_SIZE = 1000;
static int THE_AGE = 37;
int get_age()
{
return THE_AGE;
}
int *get_age_pointer()
{
return &THE_AGE;
}
2011-11-02 01:56:34 +00:00
void set_age(int age)
{
THE_AGE = age;
}
double *get_function_static(double to_add)
{
static double value = 1.0;
double old = value;
value = value + to_add;
return &value;
}
2011-11-02 01:56:34 +00:00
double update_ratio(double new_ratio)
{
static double ratio = 1.0;
double old_ratio = ratio;
ratio = new_ratio;
return old_ratio;
}
void print_size()
{
log_info("I think size is: %d", THE_SIZE);
}