The simple program Reads and traverse, write arrays and reverse the elements in an integer array.

/*******************************************************
*     MYCPLUS Sample Code - http://www.mycplus.com     *
*                                                     *
*   This code is made available as a service to our   *
*      visitors and is provided strictly for the      *
*               purpose of illustration.              *
*                                                     *
* Please direct all inquiries to saqib at mycplus.com *
*******************************************************/

#include 
#define NMAX 10

void intSwap(int *x, int *y);
int getIntArray(int a[], int nmax, int sentinel);
void printIntArray(int a[], int n);
void reverseIntArray(int a[], int n);


int main(void) {
  int x[NMAX];
  int hmny;


  hmny = getIntArray(x, NMAX, 0);
  printf("The array was: \n");
  printIntArray(x,hmny);
  reverseIntArray(x,hmny);
  printf("after reverse it is:\n");
  printIntArray(x,hmny);
}


void intSwap(int *x, int *y)
     /* It swaps the content of x and y */
{
  int temp = *x;
  *x = *y;
  *y = temp;
}


void printIntArray(int a[], int n)
     /* n is the number of elements in the array a.
      * These values are printed out, five per line. */
{
  int i;


  for (i=0; i