Rane-Kutta of order 2

Hi everybody,

I ask about a Freefem++ code of a Runge-Kutta schema of order 2 if there is one available somewhere?
I used the following code but it doesn’t work:

// Runge - Kutta Scheme of order 2…
func real [ int ] RK2( real [ int ] u, real t)
{Preformatted text
int N=5 ; // The size of vectors
real [ int ] k0 (N), k1 (N), k2 (N); // vectors of size N.
real t1;
real [ int ] uold (N);
uold = 0.;
k0=f(uold, t);
k1 = uold+ k0;
t1 = t + 0.5* dt;
k2 = f(t1,k1);
u=uold+0.5*(k0+k2);
return u ;
}

Thank you in advance.