IMPLEMENTATION OF AN FIR FILTER IN C
Filter:
/* fir.c - FIR filter in direct form */

double fir(int M, double* h, double *w, double x) {

   w[0] = x;

   for (double y=0, int i=0; i<=M; i++) {
      y += h[i] * w[i];
   }

   for (int i=M; i>=1; i--) {
      w[i] = w[i-1];
   }

   return y;
}

Dot Product:
double dot(int M, double* h, double* w) {

   for (double y=0, int i=0; i<=M; i++) {
        y += h[i] * w[i];
   }

   return y;
}