我有一个简单的函数,在它返回后,数组 a[] 的值(作为参数传递)被更改。问题是它们甚至没有写在函数中,只是读取-据说,至少-。希望你能帮助我:
double *bhaskara(double a[]){
double A = a[2], B = a[1], C = a[0];
double raizes[2];
double delta = B*B - 4*A*C;
if(delta<=0){//ignora delta para pegar soh a parte inteira das raizes
raizes[0] = -B/(2*A);
raizes[1] = raizes[0];
}else{
raizes[0] = (-B+sqrt(delta))/(2*A);
raizes[1] = (-B-sqrt(delta))/(2*A);
}
return raizes;
}