C- find a series with recursion : im trying to write a **RECURSION** function that gets an array by pointer and its size, and return the number of longest series in the array (assume that there is a series), 

    for exemple:
    array: {1 2 3 3 4 5 6 6 6 6 7 8} 
    returns-->: 4 

but i dont know whats worng with my function i think i got the all thing worng
any idea how to fix it?

    #include <stdio.h>
    #include <stdlib.h>
    
    int LongestSeries(int* arr, int size, int* count, int* maxcount);
    
    
    int main()
    {
    	int i, size, *arr, count=0, maxcount=0;
    
    	// allocation an array (unknow size)
    	{
    		printf("Enter Size of the Array-->:");
    		scanf("%d", &size);
    
    		arr = (int*)malloc(size * sizeof(int));
    		if (arr == NULL)
    		{
    			printf("Error!!");
    			exit(1);
    		}
    		printf("Enter Numbers for the Array:\n");
    		for (i = 0; i < size; i++)
    		{
    			printf("Enter a Number-->:");
    			scanf("%d", &arr[i]);
    		}
    	}
    	for (i = 0; i < size; i++)
    		printf(" %d ", arr[i]);
    	printf("\n");
    
    	printf(" %d \n", LongestSeries(arr, size, count, maxcount));
    
    	free(arr);
    	return 0;
    }
    
    
    int LongestSeries(int* arr, int size, int* count, int* maxcount)
    {
    	if (arr[size-1] == arr[size-2])
    		count++;
    	if (maxcount<count)
    		maxcount = count;
    
    	LongestSeries(arr, size - 1, count, maxcount);
    
    	if (*arr==arr[0])
    		return maxcount;
    }