Programming C - TechRepublic
General discussion
January 4, 2001 at 12:50 AM
melgibson9697

Programming C

by melgibson9697 . Updated 25 years, 5 months ago

Can someone help me to get the c program below to run?
Thanks

//
// array2.c — Read/writing/reversing integer arrays
//

#include

#define NMAX 10

void intSwap(int *x, int *y);
int getIntArray(int a[], int nmax, int sentenel);
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 n;

for (i=0; i

This discussion is locked

All Comments