- The size of the array whose maximum and minimum values have to be found out is not fixed, hence we will define a macro called max of size 100:
#define max 100
- We will define an arr array of the max size, that is, 100 elements:
int arr[max];
- You will be prompted to specify the number of elements in the array; the length you enter will be assigned to the n variable:
printf("How many values? ");scanf("%d",&n);
- Execute a for loop for n number of times to accept n values for the arr array:
for(i=0;i<n;i++) scanf("%d",&arr[i]);
- Invoke the maxmin function to pass the arr array and its length, n, to it. The array that will be returned by the maxmin function will be assigned to the integer pointer, *p:
p=maxmin(arr,n);