I´m learning C now and tried to write my own function with a variable number of parameters, which I want to work with. Is this possible? I found examples how to create such a function but I don't know how to work with them. Here is what I have:
double ftest(int amount, double dA1,...)
{
double dsumm = 0.0;
for (int i=1;i <= amount; i++){
dsum=1/dA1+1/dA2 //?? here is my Question how can I add all the parameters the user entered?
}
return dRges;
}
okay in my original post it was considered a duplicate, but I want to do more than just make a sum. I want to do different calculations with it. Like I want to be able to have them all as a them of dA1 to dAn = number of parameters. And then I want to do calculations.