Creates an array,
The implementation function init () initializes the array,
Implement empty () to empty the array,
Implements the reverse () function to complete the inverse of the array element.
Requirements: You design the parameters of the function, return the value. */
#include <stdio.h>
#include <cstdlib>
void Init (int* arr, int length)//does not open space for arr can be uninitialized.
{
int i = 0;
for (i = 0; i<length; i++)
{
Arr[i] = i;//scanf_s ("%d", &arr[i]);
}
}
void Empty (int* arr, int length)
{
int i;
for (i = 0; i<length; i++)
{
Arr[i] = 0;
}
}
void reverse (int* arr, int length)//Exchange address
{
int tmp;
int i;
for (i = 0; i<length/2; i++)
{
TMP = arr[length-i-1];
Arr[length-i-1] = arr[i];
Arr[i] = tmp;
}
}
void printf (int *arr, int length)
{
int i = 0;
for (i = 0; i<length; i++)
{
printf ("%d", arr[i]);
}
printf ("\ n");
}
int main ()
{
int arr[10];
int length = sizeof (arr)/sizeof (arr[10]);
Init (arr, length);
printf (arr, length);
Reverse (arr, length);//cannot be arr[10], which refers to the element labeled 10
printf (arr, length);
Empty (arr, length);
printf (arr, length);
System ("pause");
return 0;
}
Create an array, using functions to initialize, empty, and reverse each of them. You design the parameters of the function, return the value