I'm just starting to code, and am learning about arrays right now. I am trying to write a program that takes in a list of arrays, and tells me if the first or last number is a 2. To do this, I'm using a function.
My code looks like:
    #include <iostream>
    using namespace std;
    const int size = 6;
    bool firstlast(int array[size]);
    int main()
    {
        int array[size];
        for (int index = 0; index < size; index++)
        {
            cout << "Enter value for array[" << index << "]\n";
            cin >> array[index];
        }
        bool check = firstlast(array[size]);
        if (check)
            cout << "The array either starts or ends in 2!\n";
        else 
            cout << "The array does not start or end with 2.\n"; 
        return 0;
    }
    bool firstlast(int array[size])
    {
        if (array[0] == 2)
            return true;
        if (array[size - 1] == 2)
            return true;
        return false;
    }
What am I doing wrong? The compiler gives me the error:
candidate function not viable: no known conversion from 'int' to 'int *' for 1st argument; take the address of the argument with and
 
     
    