Hello, everyone.
So, my program is just counting the maximum of the array, however, I'd like to do that with the dynamic array (with pointers). Could someone explain me what am I doing wrong ? Thank you.
Code:
#include <stdio.h>
#include <stdlib.h>
void ArrayScan(int n, int *h);
void ArrayMaximum(int n, int *h, int x);
int main()
{
    int n, *array;
    int max = 0;




    printf("Write the number of random numbers: ");
    scanf("%d", &n);
    ArrayScan(n,&array);
    ArrayMaximum(n,array, max);
    free(array);
    getch();
}
void ArrayScan(int n, int *h)
{
 int i = 0;
 h = (int*)malloc(n* sizeof(int));
 for ( ; i<n; i++)
 scanf("%d", &h[i]);


}
void ArrayMaximum(int n, int *h, int x)
{
 int i=0;
 x = h[0];
 for( ;i<n;i++)
 {
  if (h[i]>x)
  x = h[i];
 };
 printf("The maximum is: %d", x);
}