C++, error invalid conversion from `int*' to `int'

c++

Solution

`positionH[]` is an array, and its return type is `int`.

The compiler will not let you do that. Either make the parameter an int:

int findH(int positionH){
    return positionH;        
}

Or make the return type a pointer to an int:

int* findH(int positionH[]){
    return positionH;        
}

Or convert the array to an integer before return:

int findH(int positionH[]){
    return positionH[0];
}

Problem

I have the following C++ code: ``` #include <iostream> using namespace std; int main(){ } int findH(int positionH[]){ return positionH; //error happens here. } ``` The compiler throws an error: ``` invalid conversion from `int*' to `int' ``` What does this error mean?

Original source