Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - One-dimensional plastic array in C language stores the array elements in reverse order and outputs the exchanged array, which needs to be input, exchanged and output by functions respectively.
One-dimensional plastic array in C language stores the array elements in reverse order and outputs the exchanged array, which needs to be input, exchanged and output by functions respectively.
# include & ltstdio.h & gt

Void input(int a[],int n)// input

{

int I;

Printf ("Please enter %d numbers separated by spaces \n", n);

for(I = 0; I & ltn;; i++)

scanf("%d ",& ampa[I]);

}

Void output(int a[],int n)// output

{

int I;

for(I = 0; I & ltn;; i++)

printf("%d ",a[I]);

printf(" \ n ");

}

Void reverse(int a[], int n)// reverse order

{

int temp,I;

for(I = 0; I < = (n/2); i++)

{

temp = a[I];

a[I]= a[n-I- 1];

a[n-I- 1]= temp;

}

}

int main()

{

int a[20];

Input (a, 20);

Printf ("original array: \ n");

Output (a, 20);

Inversion (a, 20);

Printf ("The array after the reverse order is: \ n");

Output (a, 20);

Returns 0;

}