This is the situation: I have written a program that given two arrays r and phi calculates the coordinates x,y,z and prints the on a file i this way:
for(int i=0; i< sizeof(r)/sizeof(r[0]); i++){ for(int j=0;j< sizeof(phi)/sizeof(phi[0]);j++){ z=atan(theta)*r[i]*cos(phi[j]); y=r[i]*sin(phi[j]); x=r[i]*cos(phi[j]); fprintf(file,"%g \t %g \t %g\n", x,y,z)}} Now I need to consider the coordinates as arrays x[],y[],z[], but I cannot find a way to fill the arrays with my current program. The problem is that I cannot find a way to properly iterate on the indices of the coordinates: for example, if I consider the index i*j I will get 0 j-times on the first iteration of i and so on.
Can anyone help?