# What exactly is stored in “output” variable in the FIR Filter code below? [duplicate]

What exactly is stored in "output" variable in the FIR Filter code below?

      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;
}


## marked as duplicate by Marcus Müller, lennon310, MBaz, Stanley Pawlukiewicz, Peter K.♦Nov 13 at 19:48

This question was marked as an exact duplicate of an existing question.

• That's a verbatim duplicate to a question you asked 5 days ago, just about output instead of buffer; already has an answer. You really just need to learn C; if you can't say what output is after having gotten the answer about buffer, then I'm sorry, you really just need to read a C introduction. – Marcus Müller Nov 11 at 19:45

The output variable holds the current output value given the current input value value. It is just the weighted sum of the current and ntaps-1 past input values. Note that this is not the most optimized version of an FIR filter routine.