RungeKutta method in C, pointers and arrays
Generally, it is preferrable to put the \ns at the end of the corresponding printf instead of relying on them being present on the next one.

printf("\n"); // &lt;-- you don't need to complicate your whole logic just because of this guy!
              //     put him on a line of his own.
printf("\y'(t) - y(t) = e^(t/2) * (sin(5t) - 10cos(5t))\n");
printf("\y(0) = 0\n");
printf("0 &lt;= t &lt;= 10\n");

for(i=0; i&lt;1001; i+=100){
    printf("i = %lf =&gt; y = %lf\n", 0.01*i, res[i]);
}


Also, as a general principle I don't like returning malloc-ed values from functions since doing so


forces you to remember to free the data even though the corresponding malloc is hidden away inside the other function and
couples your algorithm (the numeric calculations) with the memory management. It would be preferable if you were free to use any sort of memory instead of being forced into using malloc-free (as you currently are)

One possibility is passing the result array as an argument to your function:

//so you can malloc...
double *result = malloc(/**/); 
runge_kutta( /*...*/, result);
free(result);

//...or not
double results[MAX_SIZE];
runge_kutta( /*...*/, result);


Do note that in the previous example you now need to be able to know the length of the result array beforehand. Most of the times this is trivial but in some cases you might need to package this in a subroutine.


Finally, since this is a numerically intensive problem and the list of results is not really needed (since I guess you only need to look at them one at a time and in sequential order) you might want to consider reorganizing things so that you can get away without any allocation for the results array.

For, example, we could have the Runge Kutta function call a callback on each result it gets instead of storing it to an array.

void runge_kutta_2nd_order(
   /*the original arguments and...*/,
   void (*onPoint)(int index, double x_i) /*the callback*/
)
{
   //...
       onPoint(index, ystar2);
   //...
}