0

how to use call by address or call by value to replace return function?

float cal(float x,int n){ int i; float ans=1;for(i=1;i<=n;i++){ ans=ans*x; }return ans;}

8th Oct 2018, 2:16 PM
翁shuai
翁shuai - avatar
1 Respuesta
+ 2
你可以用 ref static void calRef(ref float x, int n) { int i; float ans=1; for(i=1;i<=n;i++) { ans=ans*x; } x = ans; } https://code.sololearn.com/cTE03WmWHHNi/?ref=app
8th Oct 2018, 2:57 PM
Calviղ
Calviղ - avatar