Home Segments Index Top Previous Next

667: Mainline

For example, you might want to add a prediction function, predict, that predicts the price of trade n, given the prices of trades 0 through n-1. You would add the definition of predict, along with definitions for any auxiliary functions, to the trades.c file. You would also augment the trades.h header file with a function prototype for the predict function. Assuming that your implementation of predict has two parameters—one for a pointer to the trades array and one for the number of trades accumulated in the array—then the addition to the trades.h file would be as follows:

double predict (struct trade **, int); 

You do not need to include function prototypes for any auxiliary functions, assuming that those auxiliary functions are not called from functions in other files.