I am new to c and i have a problem i cant seem to figure out. The problem states .....
Create a file and call it testdata21. The file should contain exactly 15 integer values. Read these 15 numbers into a one-dimensional array. then print the numbers out in reverse order from which they were entered.
I have tried every possible thing i can think of and my cook isn't very helpful. I have for the most part removed any code that im pretty sure wasn't right and this is what i got. im pretty sure im right so far im jsut missing some things.
Code:
#include <stdio.h>
int main(int argc, char *argv[]){
int number[15] ;
FILE *Fin = NULL;
int i;
Fin =fopen("testdata21","r");
for(i = 15; i >= 0; i--){
fscanf(Fin,"%d",&number[]);
printf("%d",number[]);
}
fclose(Fin);
return 0 ;
}
Any help would be greatly appreciated thanks.