Problem converting code with #include <stdlib.h>

I am working again to implement an audio filter in Unity3d for flexible use in synths: C64 synth, speak and spell voice synth, ambient sounds synth… I didnt know unity has awesome audio DSP potential, all i need now is 2-3 filter functions to apply to a sound samples array,
i.e. var sound= new float[44100] is a 1 second sawtooth wave,
i want function bandpass(sound:float[ ] , cutoffrequency :float ) etc

So i have found a page full of commercially useable filter codes, but i don’t know very well what language they are written in and how to use them in Unity. I learnt to code in UnityScript and Reaktor DSP studio so i am not great a C#.

even the first lines: #include <stdlib.h> doesn’t compile

How can i implement a standard filter from here:
http://musicdsp.org/archive.php?classid=3#263
so i can work on some giant synths in unity with 20 oscillators and everything.

for example, this moog filter code is fairly clear, but i am not sure what the loop consists of, and how to apply it to array samples:

//Init
cutoff = cutoff freq in Hz
fs = sampling frequency //(e.g. 44100Hz)
res = resonance [0 - 1] //(minimum - maximum)

f = 2 * cutoff / fs; //[0 - 1]
k = 3.6*f - 1.6*f*f -1; //(Empirical tunning)
p = (k+1)*0.5;
scale = e^((1-p)*1.386249;
r = res*scale;
y4 = output;

y1=y2=y3=y4=oldx=oldy1=oldy2=oldy3=0;

//Loop
//--Inverted feed back for corner peaking
x = input - r*y4;

//Four cascaded onepole filters (bilinear transform)
y1=x*p + oldx*p - k*y1;
y2=y1*p+oldy1*p - k*y2;
y3=y2*p+oldy2*p - k*y3;
y4=y3*p+oldy3*p - k*y4;

//Clipper band limited sigmoid
y4 = y4 - (y4^3)/6;

oldx = x;
oldy1 = y1;
oldy2 = y2;
oldy3 = y3;

stdlib.h is a C library… Would you be able to post more complete code with all the variable declarations, would make it a bit easier to understand and port the code…

That’s the complete code after the intro line. This one is also moog, it’s even easier, and i have to devise a kind of function wrapper for it to run it on all sound data in an audio array. i think that y1 y2 y3 y4 are snd[1] snd[2] snd[3] snd[4] …

(version 2 of same code from musicdsp.org)

Notes :
in[x] and out[x] are member variables, init to 0.0 the controls:

fc = cutoff, nearly linear [0,1] -> [0, fs/2]
res = resonance [0, 4] -> [no resonance, self-oscillation]

Code :
Tdouble MoogVCF::run(double input, double fc, double res)
{
double f = fc * 1.16;
double fb = res * (1.0 - 0.15 * f * f);
input -= out4 * fb;
input *= 0.35013 * (f*f)*(f*f);
out1 = input + 0.3 * in1 + (1 - f) * out1; // Pole 1
in1 = input;
out2 = out1 + 0.3 * in2 + (1 - f) * out2; // Pole 2
in2 = out1;
out3 = out2 + 0.3 * in3 + (1 - f) * out3; // Pole 3
in3 = out2;
out4 = out3 + 0.3 * in4 + (1 - f) * out4; // Pole 4
in4 = out3;
return out4;
}