Any advise? What is wrong? It gives meaningless result but as always it looks fine by me (

Code:

#include<stdio.h>
int largest(int a[], int n)
{
int largestD;
largestD = a[0];
for(int i = 1; i < n; i++)
if(a[i] > largestD) largestD = a[i];
return largestD;
}
int average(int a[], int n)
{
int averageD = 0;
for(int i = 0; i < n; i++)
averageD += a[i];
return averageD / n;
}
int positive(int a[], int n)
{
int h = 0;
for(int i = 0; i < n; i++)
if(a[i] > 0) h++;
return h;
}
int main(void)
{
int n;
int a[n];
printf("Enter a lenght of array a: ");
scanf("%d", &n);
printf("Enter %d elements of array: ", n);
for(int i = 0; i <= n - 1; i++)
scanf("%d", &a[i]);
for(int i = 0; i <= n - 1; i++)
printf("%d ", a[i]);
printf("\nLargest number is: %d\n", largest);
printf("Average of aray is : %d\n", average);
printf("Numbers of positive digits is: %d", positive);
return 0;
}

Enter a lenght of array a: 5

Enter 5 elements of array: 1

2

3

4

5

1 2 3 4 5

Largest number is: -444131880

Average of aray is : -444131774

Numbers of positive digits is: -444131693

PS C:\Users\nirva\Desktop\c files\.vscode\Book_2\9_Function>