I'm new here and am seeking some help with an assignment. I understand that a recursive function calls itself. However, I've been working on this assignment for some time and can't get it to work. Can someone help by stating what part of my code is wrong and explain why? I'm confused because I don't understand how a recursive function would handle an array. I've searched and only found the Fibonacci Series.

The assignement is to use a recursive function called linearSearch to perform linear search of the array. The function should receive an interger array and the size of the array as arguments. If the search key is found, return the array subscript; otherwise, return -1.

Thank you very much for any help.

#include <iostream>
#include <conio.h>
using namespace std;

int linearSearch( int [], int );

int main()
   const int arraySize = 100;
   int a[arraySize];
   int element;

   for( int i = 0; i < arraySize; i++)
      a[i] = 2 * i;

   element = linearSearch( a, arraySize );

   if( element != -1 )
      cout << "Found value in element " << element << endl;

      cout << "Value not found." << endl;

   return 0;

int linearSearch( int array[], int counter )
   if( linearSearch( array, counter - 1 ) != 10 )
      return counter;
    return -1;