I am trying to write a function `int* findPair(int* data, int numEls, int first, int second)`to search in an int array data for an element equal to first followed immediately by an element second. If this situation occurs, the function returns a pointer to the element first. If the situation occurs more than once in the array, the pointer should be to the first occurrence. 
My code is like this:

```
#include <stdio.h>
int* findPair(int* data, int numEls, int first, int second)
{
    int i = 0;
    int *n = NULL;
    for (i = 0; i < numEls; i++) {
        if(data[i] == first && data[i + 1] == second) {
            n = &data[i];
        }

    }
    return n;

}
int main()
{
    int data[] = {1, 10, 2, 1, 2, 1, 2};
    int* p = findPair(data, 7, 1, 2);
    if (p != NULL) {
        printf("Found at position %zd\n", p - data);
    }
    else {
        puts("Not found");
    }
}

```

When I entered two `1,2`for testing and it pointed to the second occurence( position 5 instead of position 3).Any hint where I did wrong?