second largest element in an array

#include <stdio.h>

void findSecondLargest(int arr[], int size) {
    int first, second;

    if (size < 2) {
        printf("Array size is too small.\n");
        return;
    }

    first = second = INT_MIN;

    for (int i = 0; i < size; i++) {
        if (arr[i] > first) {
            second = first;
            first = arr[i];
        } else if (arr[i] > second && arr[i] != first) {
            second = arr[i];
        }
    }

    if (second == INT_MIN) {
        printf("There is no second largest element.\n");
    } else {
        printf("The second largest element in the array is: %d\n", second);
    }
}

int main() {
    int arr[] = {10, 20, 4, 45, 90}; // Change the array elements as needed
    int size = sizeof(arr) / sizeof(arr[0]);

    findSecondLargest(arr, size);

    return 0;
}