Quote:
Originally Posted by xpi0t0s View Post
Pass them in as parameters:
Code:
void calc_volts(double *volts,double *current,double *resistance);
int main()
{
    double volts[10];
    double current[10] = {10.62 ,14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, 3.8};
    double resistance[10] = {4.0, 8.5, 6.0, 7.35, 9.0, 15.3, 3.0, 5.4, 2.9, 4.8};
 
    calc_volts(volts, current, resistance);
 
    return 0;
}
Then just replace ???? with 10 and that should do the trick. You might want to display the results somewhere as well.

calc_volts() doesn't need to return anything but it will need to take the three arrays as parameters/arguments.
Ok thanks that makes sense. I actually do need to return the array that was filled and display the results in main(). If it's returning an array I can still use double for the return since all the values in the array will be doubles correct? If not how would I go about returning the array itself.