Implementing a continuous time transfer function in PC code
You are asking about the world of numerical solutions for ordinary differential equations. And I think what you are trying to get to in your code is essentially Euler's Method for solving this kind of equation. However, I think you've somewhat turned yourself around in analyzing the problem. 

Instead of your equation, \$y(t) = x(t) - Ty'(t)\$, it's more common to analyze this problem by rearranging terms:

\$y'(t) = \frac{1}{T}(x(t)-y(t))\$

To apply Euler's method, we estimate the evolution of \$y(t)\$ by

\$y(t+h) = y(t) + hy'(t)\$,

where h is a timestep for the numerical solution (the dt in your code). We can put this in discrete time notation as:

\$y_{n+1} = y_n + hy'_n\$

This is a general formulation for any ordinary differential equation. For your problem, you'd have

\$y_{n+1} = y_n + h\frac{1}{T}(x_n - y_n)\$.

Which you can easily translate into C code.

That said, this method tends to not be particularly accurate. The overall error in the solution grows in proportion to the step size of the simulation, and the numerical method itself can be unstable (errors can go to infinity even if the real solution is finite) under some circumstances.

The usual method (a method that works for many problems; something to try first before looking for more advanced methods in case your problem turns out to be especially difficult) is fourth-order Runge-Kutta integration. The equations for this are somewhat more involved, but 1) many pre-written libraries are available to do it, and 2) if you work through the equations carefully you'll find they all fall into place very nicely. There are also numerous elaborations available in libraries, for example to automate finding the largest step size (and thus least processing time) to obtain the required accuracy in the solution.,