```
#include<iostream>
#include<string>
#include<sstream>
#include<conio.h>
#include<vector>
#define MAX 100
using namespace std;
int size;

int getlargest(int arr[ ]){
    static int max = -1000;
    static int i = 0;
    if(i < size){
        if(arr[i] >= max){
            max = arr[i];
            i++;
        }
        getlargest(arr);
    }
    return max; 
}

int main(){

    int res;
    cout << "enter the size please: ";
    cin >> size;
    int arr[MAX];

    for(int i=0;i<size;i++){
        cin >> arr[i];
    }
    res = getlargest(arr);
    cout << res;
    getch();
    return 0;
}

```

I am not experienced with the concept of recursive functions. This code was written to find the maximum element of an array. However, I am getting a stack overflow error. Could anyone correct it? Also, I don't know exactly where to insert recursion.