To compile trades.c
, the C compiler also needs to know
about the trade structure declared in trades.h
.
Accordingly, you provide access to the trades.h
file via
another #include
declaration:
/* Trades definition file (c extension) */ #include "trades.h" double mean_price (struct trade **array, int length) { int counter; double sum = 0.0; for (counter = 0; counter < length; ++counter) sum = sum + array[counter] -> price; return sum / counter; } double mean_size (struct trade **array, int length) { int counter; double sum = 0.0; for (counter = 0; counter < length; ++counter) sum = sum + array[counter] -> number; return sum / counter; }