diff --git a/exercises/practice/all-your-base/all_your_base.h b/exercises/practice/all-your-base/all_your_base.h index a48979964..73ed28095 100644 --- a/exercises/practice/all-your-base/all_your_base.h +++ b/exercises/practice/all-your-base/all_your_base.h @@ -3,4 +3,7 @@ #define DIGITS_ARRAY_SIZE 64 +size_t rebase(int8_t digits[DIGITS_ARRAY_SIZE], int16_t from_base, + int16_t to_base, size_t num_digits); + #endif diff --git a/exercises/practice/allergies/allergies.h b/exercises/practice/allergies/allergies.h index e34a18cdf..42f93fc0d 100644 --- a/exercises/practice/allergies/allergies.h +++ b/exercises/practice/allergies/allergies.h @@ -20,4 +20,7 @@ typedef struct { bool allergens[ALLERGEN_COUNT]; } allergen_list_t; +bool is_allergic_to(allergen_t allergen, unsigned int score); +allergen_list_t get_allergens(unsigned int score); + #endif diff --git a/exercises/practice/circular-buffer/circular_buffer.h b/exercises/practice/circular-buffer/circular_buffer.h index 9f809d42c..ec13e26d0 100644 --- a/exercises/practice/circular-buffer/circular_buffer.h +++ b/exercises/practice/circular-buffer/circular_buffer.h @@ -1,4 +1,30 @@ #ifndef CIRCULAR_BUFFER_H #define CIRCULAR_BUFFER_H +#include +#include + +typedef int16_t buffer_value_t; +typedef struct circular_buffer_t circular_buffer_t; + +// constructs a new buffer +circular_buffer_t *new_circular_buffer(size_t capacity); + +// read next value from buffer +int16_t read(circular_buffer_t *buffer, buffer_value_t *value); + +// write a value to the buffer +int16_t write(circular_buffer_t *buffer, buffer_value_t value); + +// write a value to the buffer +// overwrites the oldest value if the buffer is already full +int16_t overwrite(circular_buffer_t *buffer, buffer_value_t value); + +// clear the buffer +void clear_buffer(circular_buffer_t *buffer); + +// destroy the entire buffer +// buffer will be a dangling pointer after calling this method on it +void delete_buffer(circular_buffer_t *buffer); + #endif diff --git a/exercises/practice/darts/darts.h b/exercises/practice/darts/darts.h index 287cf1f32..194a6df8a 100644 --- a/exercises/practice/darts/darts.h +++ b/exercises/practice/darts/darts.h @@ -1,4 +1,12 @@ #ifndef DARTS_H #define DARTS_H +#include + +typedef struct { + float x, y; +} coordinate_t; + +uint8_t score(coordinate_t landing_position); + #endif diff --git a/exercises/practice/perfect-numbers/perfect_numbers.h b/exercises/practice/perfect-numbers/perfect_numbers.h index 13f32a648..400c126ee 100644 --- a/exercises/practice/perfect-numbers/perfect_numbers.h +++ b/exercises/practice/perfect-numbers/perfect_numbers.h @@ -8,4 +8,6 @@ typedef enum { ERROR = -1 } kind; +kind classify_number(int); + #endif diff --git a/exercises/practice/pythagorean-triplet/pythagorean_triplet.h b/exercises/practice/pythagorean-triplet/pythagorean_triplet.h index a911dfa55..aca768c0f 100644 --- a/exercises/practice/pythagorean-triplet/pythagorean_triplet.h +++ b/exercises/practice/pythagorean-triplet/pythagorean_triplet.h @@ -1,4 +1,20 @@ #ifndef PYTHAGOREAN_TRIPLET_H #define PYTHAGOREAN_TRIPLET_H +#include +#include + +typedef struct { + uint16_t a, b, c; +} triplet_t; + +typedef struct { + size_t count; + triplet_t triplets[]; +} triplets_t; + +triplets_t *triplets_with_sum(uint16_t sum); + +void free_triplets(triplets_t *triplets); + #endif diff --git a/exercises/practice/rational-numbers/rational_numbers.h b/exercises/practice/rational-numbers/rational_numbers.h index f00b697de..0928221dc 100644 --- a/exercises/practice/rational-numbers/rational_numbers.h +++ b/exercises/practice/rational-numbers/rational_numbers.h @@ -1,4 +1,26 @@ #ifndef RATIONAL_NUMBERS_H #define RATIONAL_NUMBERS_H +#include + +typedef struct { + int16_t numerator, denominator; +} rational_t; + +rational_t add(rational_t r1, rational_t r2); + +rational_t subtract(rational_t r1, rational_t r2); + +rational_t multiply(rational_t r1, rational_t r2); + +rational_t divide(rational_t r1, rational_t r2); + +rational_t absolute(rational_t r); + +rational_t exp_rational(rational_t r, uint16_t n); + +float exp_real(uint16_t n, rational_t r); + +rational_t reduce(rational_t r); + #endif diff --git a/exercises/practice/resistor-color-duo/resistor_color_duo.h b/exercises/practice/resistor-color-duo/resistor_color_duo.h index d432fc8e3..fe8f3f5d9 100644 --- a/exercises/practice/resistor-color-duo/resistor_color_duo.h +++ b/exercises/practice/resistor-color-duo/resistor_color_duo.h @@ -1,4 +1,11 @@ #ifndef RESISTOR_COLOR_DUO_H #define RESISTOR_COLOR_DUO_H +#include + +typedef enum { +} resistor_band_t; + +uint16_t color_code(resistor_band_t colors[]); + #endif diff --git a/exercises/practice/resistor-color-trio/resistor_color_trio.h b/exercises/practice/resistor-color-trio/resistor_color_trio.h index 903a06726..f96f6a48c 100644 --- a/exercises/practice/resistor-color-trio/resistor_color_trio.h +++ b/exercises/practice/resistor-color-trio/resistor_color_trio.h @@ -1,4 +1,19 @@ #ifndef RESISTOR_COLOR_TRIO_H #define RESISTOR_COLOR_TRIO_H +#include + +typedef enum { +} resistor_band_t; + +typedef enum { +} resistor_unit_t; + +typedef struct { + uint16_t value; + resistor_unit_t unit; +} resistor_value_t; + +resistor_value_t color_code(resistor_band_t colors[]); + #endif diff --git a/exercises/practice/resistor-color/resistor_color.h b/exercises/practice/resistor-color/resistor_color.h index 6adf79773..5a09a9752 100644 --- a/exercises/practice/resistor-color/resistor_color.h +++ b/exercises/practice/resistor-color/resistor_color.h @@ -1,8 +1,13 @@ #ifndef RESISTOR_COLOR_H #define RESISTOR_COLOR_H -typedef enum { +#include +typedef enum { } resistor_band_t; +uint16_t color_code(resistor_band_t color); + +const resistor_band_t *colors(void); + #endif diff --git a/exercises/practice/saddle-points/saddle_points.h b/exercises/practice/saddle-points/saddle_points.h index ab8d5ea7f..9006f998c 100644 --- a/exercises/practice/saddle-points/saddle_points.h +++ b/exercises/practice/saddle-points/saddle_points.h @@ -1,4 +1,21 @@ #ifndef SADDLE_POINTS_H #define SADDLE_POINTS_H +#include +#include + +typedef struct { + size_t row, column; +} saddle_point_t; + +typedef struct { + size_t count; + saddle_point_t points[]; +} saddle_points_t; + +saddle_points_t *saddle_points(size_t rows, size_t columns, + uint8_t matrix[][columns]); + +void free_saddle_points(saddle_points_t *saddle_points); + #endif diff --git a/exercises/practice/square-root/square_root.h b/exercises/practice/square-root/square_root.h index 685c00f24..8580295d2 100644 --- a/exercises/practice/square-root/square_root.h +++ b/exercises/practice/square-root/square_root.h @@ -1,4 +1,8 @@ #ifndef SQUARE_ROOT_H #define SQUARE_ROOT_H +#include + +uint16_t square_root(uint16_t radicand); + #endif diff --git a/exercises/practice/triangle/triangle.h b/exercises/practice/triangle/triangle.h index 9722a9b64..8bedf0e44 100644 --- a/exercises/practice/triangle/triangle.h +++ b/exercises/practice/triangle/triangle.h @@ -1,10 +1,16 @@ #ifndef TRIANGLE_H #define TRIANGLE_H +#include + typedef struct { double a; double b; double c; } triangle_t; +bool is_equilateral(triangle_t sides); +bool is_isosceles(triangle_t sides); +bool is_scalene(triangle_t sides); + #endif