I'm programming average calculating function by using Variadic Functions method, but I didn't get yet what is the wrong in my code:
// D programming language
import std.stdio;
import core.vararg;
import std.conv;
float foo(...)
{
float x=0;
for(int i=0; i<_arguments.length; ++i){
x+=to!float(_arguments[i]);
}
x/=_arguments.length;
return x;
}
int main()
{
writeln(foo(2,3));
return 0;
}