float 포인터와 int 포인터를 사용하는 메서드가 있습니다. 다음에 pow(the float, the int)
을 수행하고 값을 반환합니다. 나는 그것이 나에게 말하는 것이 틀렸다는 것을 이해할 수없는 커다란 오류를 얻는다.int 포인터의 힘에 대한 C++ 플로팅 포인터
#include <cmath>
#include <iostream>
using namespace std;
float method3(float *f, int *i); //initialize pointer method
float flt; //init variable
int nt; //init variable
int main() {
method3(*flt, *nt); //run method 3, which will do the same math, but with pointers instead of value or reference
cout << flt; //print it out
return 0;
}
float method3(float *f, int *i) { //method 3, get float and int by pointers
return pow(f, i); //f to power of i back to original flt variable
}
내가 뭘 잘못하고 있는지 알려주시겠습니까?
'* flt'과'* nt'는 의미가 없습니다. '*'에 대한 인수는'float' 또는'int'가 아닌 포인터 여야합니다. – Barmar
'void' 리턴 타입과'return pow (f, i);를 반환하는 것은 단지 균형 적으로 잘못되었습니다! 또한 나는 왜 이러한 매개 변수가 값으로 전달되는 것이 아니라 단순히 포인터로 전달되는 이유를 알 수 없습니다. –
'return pow (* f, * i);'그런 다음 이상한 함수 서명을 주장하면! –