I have a couple of questions all relating to the same code. In this code, I am trying to return the value for V, Ug1, Ug2, Vg1, and Vg2 from the "submerged_volume" function. Then, I want to use these values in the "centre_of_buoyancy" function. From that function, I want to return two values: Uc, and Vc. Finally, I want to call these functions using the header file in my main, and use the returned values from the functions for further calculations! I have not included the main body as it just has long calculations, so for the sake of space, here's a summarised version of my code:
#ifndef DATE_H_
#define DATE_H_
double submerged_volume(double L1, double L2, double Lavg, double H) {
//Boat parameters
double V1, V2;
double Ug1, Ug2, Vg1, Vg2; //lengths in U and V direction in relation to gravity
double V; //Submerged volume
//Initialising V, the value to calculate
V = 0;
//Volume Calculations
....
....
return V, Ug1, Ug2, Vg1, Vg2, V1, V2;
}
double centre_of_buoyancy(double Ug1, double Ug2, double Vg1, double Vg2, double V1, double V2);
//Calculations for Uc and Vc
.....
.....
return Uc, Vc;
}
#endif
I understand that this won't work as I can't return multiple variables. My question is, is there some way that I can do this? I'm very new to C and am not sure exactly how to use things like this!