# What exactly is stored in the buffer array in the code below? Is it the values of x[n-k] or something else?

What exactly is stored in the buffer array in the FIR Filter code below? Is it the values of x[n-k] or something else?

float filter (float value){
for (int i = ntaps-1; i>0; i--){
buffer[i] = buffer[i-1];
}
buffer[0] = value;
for (int i = 0; i<ntaps; i++){
output += buffer[i]*h[i];
}
return ouput;
}

• please edit and correct the missing code and put relevant information on the variables and the buffer data... – Fat32 Nov 6 '19 at 20:43

It stores the last $$ntap$$ samples of the input. So it's $$x[n], x[n-1], ..., x[n-N+1]$$