Hey guys, I'm working on what should be a fairly simple program. This is a function I'm having trouble with. It's probably some stupid mistake but if so I can't see it. I want the function to set each variable in an array to a fraction (decimal), but each value after arrays ends up as 0. I'm pretty sure the problem lies within the function after checking the variables while debugging.
I want the array's values to be set like this:
double init(double arrays, int n)
for (counter = 0; counter <= n; counter++)
arrays[counter] = 1 / (counter + 1);
a = 1/1, a = 1/2, a = 1/3 ... a[n] = 1/(n+1)
Any help is greatly appreciated!
EDIT: I doubt this will help but I started the function in main() using this line: init(arrays, n);