0

Hey! I have a problem. I've been coding Python for two years now, and it's great, but now I'd like to use a module called "ctypes" to import C function into Python. I know how to do it and all, but the problem is: I know how to program in C# (a fair bit) but I have no clue of how to translate that into ordinary C. Here's my C# function (in case you know C#, of course):

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KarlsTools;
public class Program
{
public static Array ITERATE(double z_r,double z_i,double c_r,
double c_i, int iterations,
double limit)
{
Complex z = new Complex(z_r, z_i);
Complex c = new Complex(c_r, c_i);
for (double i = 1; Math.Round(i) <= iterations; i++)
{
z = Complex.Pow(z, 2) + c;
if (Complex.Abs(z) < limit)
{
double[] numbers = new double[] { Complex.Real(z),
Complex.Imag(z),
Complex.Real(c),
Complex.Imag(c),
i};
return numbers;
}
}
double iter = iterations;
double[] result = new double[] { Complex.Real(z),
Complex.Imag(z),
Complex.Real(c),
Complex.Imag(c),
iter};
return result;
}
}
```

Could anyone provide some directives on how to translate this little piece of code into C? I mean, it's a REALLY simple function so it must take like 5 minutes to write it in C, just that I don't know how. I woldn't even have to import a complex math module since C has native support for complex math... Thank you in advance.