I tried to execute the code but I got this error
./Array.c: line 9: syntax error near unexpected token '('
./Array.c: line 9: ' nvals = get_data(a,MAXARRAY);'
and
#include<stdio.h>
#define MAXARRAY 1000
main()
{
int a[MAXARRAY],
nvals;
nvals = get_data(a,MAXARRAY);
printf("Values in reverse order:\n\n");
reverse_print(a,nvals);
}
int get_data(int vals[],int max)
{
int n = 0;
while (n < max && scanf("%d", &vals[n]) == 1)
n++;
return n;
}
int reverse_print (vals, n)
int vals[], n;
{
int i;
for (i =n -1; i>= 0; i--)
printf("%d\n", vals);
}
I did compile this file and it didn't show any error but when I execute it then it gave me error. I'm running this code in Unix. This is my first time by the way.
ok I did compile the code and I do see "a.out" in the directory. couldn't get to input part
---------- Post updated at 02:31 PM ---------- Previous update was at 02:28 PM ----------
ok I execute the generated "a.out" input all the integers and gave the the reverse order thank you! but why does it generated to "a.out" I want to understand how it works?