Operations on arrays in C Language
# Include <stdio. h> # include <stdlib. h> // initialize the array void init (int arr [], int length) {int I = 0; printf ("initialize the array->: \ n "); for (I = 0; I <length; I ++) {scanf_s ("% d", & arr [I]) ;}} // array reverse output void reverse (int arr [], int length) {int I = 0; printf ("reverse array->: \ n "); for (I = length-1; I> = 0; I --) // The array subscript starts from 0 {printf ("% d ", arr [I]) ;}}// clear the Array (that is, all elements in the array are zero) void empty (int arr [], int length) {int I = 0; printf ("Clear array->: \ n"); for (I = 0; I <length; I ++) {arr [I] = 0; printf ("% d", arr [I]) ;}} int main () {int arr [10]; int I = 0; int length = 0; length = sizeof (arr)/sizeof (arr [0]); // call init (arr, length); reverse (arr, length ); printf ("\ n"); empty (arr, length); system ("pause"); return 0 ;}