Skip to content

Instantly share code, notes, and snippets.

@clojj
Created November 7, 2018 08:14
Show Gist options
  • Save clojj/619ed0a9c2813dc0ae9b078e0e3347bb to your computer and use it in GitHub Desktop.
Save clojj/619ed0a9c2813dc0ae9b078e0e3347bb to your computer and use it in GitHub Desktop.
/* A table of factorials. table[i] is the factorial of i. The
* max field is calculated so that its factorial would not be an
* integer overflow.
*/
typedef struct {
unsigned max;
unsigned *table;
} factorial_table;
int factorial_table_init(factorial_table *t);
int factorial_get(factorial_table *t, int n);
void factorial_table_free(factorial_table *t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment