Онлайн компилятор C

#include <stdio.h> enum { SIZE = 10 }; int main() { int A[SIZE]; int max, min; for (int i = 0; i < SIZE; i++) { scanf("%d", &A[i]); } max = A[0]; min = A[0]; for (int i = 0; i < SIZE; i++) { if (max <= A[i]) { max = A[i]; } } A[i] = max; printf("%d %d ", i, max); for (int i = 0; i < SIZE; i++) { if (min >= A[i]) { min = A[i]; } } A[i] = min; printf("%d %d ", i, min); return 0; }
The code reads 10 integers into an array, then finds the maximum and minimum values. However, it has several issues with variable scope and incorrect assignments.

- The variable `i` used in `A[i] = max;` and `A[i] = min;` is not defined in that scope. The `i` from the previous `for` loop is out of scope after the loop ends, so these lines will cause a compilation error.
- The code attempts to assign `max` and `min` back into the array at index `i`, but this is not needed for finding the maximum and minimum. The purpose of these assignments is unclear and likely a mistake.