Q:

Finding of specific values in an array C++

I want to find the position of an element in an array, the thing is that when I create the function to return the index of the desired element the if statement does not work. However, if I do it in the main function it works perfectly. I would appreciate if someone could explain me why this is happening.
#include <iostream>
#include <algorithm>
int find_index(double vector, double *value, int size_vector);

int main() {
    double vec_eye_x[2]={2323,1}; // center position x two eyes.
    double vec_eye_y[2]={33,2}; // center position y two eyes.
    int index_val=1;
    double *yc_max=std::max_element(vec_eye_y,vec_eye_y+2); // Creating a pointer
    double *yc_min=std::min_element(vec_eye_y, vec_eye_y+2);
    double *xc_max=std::max_element(vec_eye_x,vec_eye_x+2);
    double *xc_min=std::min_element(vec_eye_x, vec_eye_x+2);

    int index=0;
    for(int i=0; i<2; i++){
        if(*xc_min==vec_eye_x[i]){std::cout<<"Works in the main function"<<std::endl;}
    }
    std::cout << "index val: " <<find_index(vec_eye_x, &xc_max,2)<<std::endl;
    return 0;
}

int find_index(double vector_x, double *value, int size_vector){
    int index=0;
    for(int i=0; i<size_vector; i++){
        if(*value==vector_x[i]){index=i;}
    }
    return index;
}

A:

Index of that element is simply 
std::distance(vec_eye_x, xc_max);

Or if you insist on pointer arithmetic then 
xc_max - vec_eye_x;

Note: std::distance is declared in header <iterator>

If you insist on using your original method with iterating over the array again, then the issue with your code was pointed by @Davide Spataro in their answer. Your first argument to find_index is a single double, not an array.

A:

Aside from the issues mentioned by Davide, you also have an inconsistency problem: in your "main function" test, your are looking for the position of *xc_min; however, the value (to search for) that you pass to find_index is xc_max!
Here's a working version of your code, with changes annotated with triple-slash (///) comments:
#include <iostream>
#include <algorithm>
int find_index(double* vector, double* value, int size_vector); /// NOTE: 1st argument shuld be pointer (array)!

int main() {
    double vec_eye_x[2] = { 2323,1 }; // center position x two eyes.
    double vec_eye_y[2] = { 33,2 }; // center position y two eyes.
    int index_val = 1;
    double* yc_max = std::max_element(vec_eye_y, vec_eye_y + 2); // Creating a pointer
    double* yc_min = std::min_element(vec_eye_y, vec_eye_y + 2);
    double* xc_max = std::max_element(vec_eye_x, vec_eye_x + 2);
    double* xc_min = std::min_element(vec_eye_x, vec_eye_x + 2);

    int index = 0;
    for (int i = 0; i < 2; i++) {
        if (*xc_min == vec_eye_x[i]) { std::cout << "Works in the main function (" << i << ")" << std::endl; }
    }
    std::cout << "index val: " << find_index(vec_eye_x, xc_min, 2) << std::endl;/// Changed "&xc_max" to "xc_min"
    return 0;
}

int find_index(double* vector_x, double* value, int size_vector) { /// NOTE: 1st argument shuld be pointer (array)!
    int index = 0;
    for (int i = 0; i < size_vector; i++) {
        if (*value == vector_x[i]) { index = i; }
    }
    return index;
}

