Skip to content

Instantly share code, notes, and snippets.

@J3698
Created May 7, 2019 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save J3698/41714b49a8594450c7fba9ac6a4834f0 to your computer and use it in GitHub Desktop.
Save J3698/41714b49a8594450c7fba9ac6a4834f0 to your computer and use it in GitHub Desktop.
#ifndef MV_AVG_H
#define MV_AVG_H
typedef struct {
double average;
size_t oldest_index;
double *samples;
size_t num_samples;
} movingAverage_t;
movingAverage_t* movingAverage_new(size_t);
void movingAverage_free(movingAverage_t*);
void movingAverage_update(movingAverage_t*, double);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment