# MaxMin1D

AnalysisLibErrType MaxMin1D (double inputArray[], int numberOfElements, double *maxValue, int *maxIndex, double *minValue, int *minIndex);

## Purpose

Finds the maximum and minimum values in the input array and their locations in the array. If there are multiple instances of the maximum and/or minimum values, MaxMin1D returns the location of the first occurrence.

### Example

/* Generate an array with random and find the maximum and minimum values. */
double x[20], y[20];
double maxValue, minValue;
int n, maxIndex, minIndex;
n = 20;
Uniform (n, 17, x);
MaxMin1D (x, n, &maxValue, &maxIndex, &minValue, &minIndex);

## Parameters

Input
Name | Type | Description
inputArray | double-precision array | The array from which the maximum and minimum values and their locations within the array are determined.
numberOfElements | integer | Number of elements used in determining the maximum and minimum values.
Output
Name | Type | Description
maxValue | double-precision | Maximum value found in the input array.
maxIndex | integer | The index of the maximum value found in the input array.
minValue | double-precision | Minimum value found in the input array.
minIndex | integer | The index of the minimum value found in the input array.

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.