C Workshop
Fibonacci.h File Reference
#include <stdio.h>

Go to the source code of this file.

Typedefs

typedef unsigned long long int ull_t
 Shorthand for "unsigned long long int". More...
 

Functions

ull_t Fibonacci (size_t n)
 Returns the nth fibonacci number. More...
 
int InitFibonacci (void)
 Initializes resources for Fibonacci. More...
 
void FinalizeFibonacci (void)
 Frees resources for Fibonacci. More...
 

Typedef Documentation

◆ ull_t

typedef unsigned long long int ull_t

Shorthand for "unsigned long long int".

Function Documentation

◆ Fibonacci()

ull_t Fibonacci ( size_t  n)

Returns the nth fibonacci number.

Parameters
nThe index of the fibonacci number to return
Returns
The nth fibonacci number
Note
The function is only guaranteed to work for n >= 0. No checking is done that memory is available for the lookup table.
Parameters
nThe index of the fibonacci number to return
Returns
The nth fibonacci number

◆ FinalizeFibonacci()

void FinalizeFibonacci ( void  )

Frees resources for Fibonacci.

Note
This function can be called multiple times. After calling Fibonacci, you will need to call this function again to free the resources.

◆ InitFibonacci()

int InitFibonacci ( void  )

Initializes resources for Fibonacci.

Returns
0 on success, -1 on failure to allocate memory