Answer:
#include <stdio.h>
#include <stdlib.h>
// Function prototype
int minValue(int *arr, int size);
int main() {
// Ask the user for the size of the array
int size;
printf("Enter the size of the array: ");
scanf("%d", &size);
// Allocate memory for the array
int *arr = malloc(size * sizeof(int));
// Read the values from the user
printf("Enter the values: ");
for (int i = 0; i < size; i++) {
scanf("%d", arr + i);
}
// Compute and print the minimum value
int min = minValue(arr, size);
printf("The minimum value is: %d\\", min);
// Free the allocated memory
free(arr);
return 0;
}
// Function to compute the minimum value in an array
int minValue(int *arr, int size) {
// Initialize the minimum value with the first element
int min = *arr;
// Iterate over the remaining elements and update the minimum value
for (int i = 1; i < size; i++) {
int value = *(arr + i);
if (value < min) {
min = value;
}
}
// Return the minimum value
return min;
}