I'm pretty new to C and I'm having difficulty with a few different concepts, including pointers, arrays, and reading files. Here is my program I've started, I'm sure their are a few errors, could you show me what I'm doing wrong? The program is supposed to read the letters from congress.txt and store them as capital letters without spaces, I also tried to make a little test which will print the letters for me so I can see if the characters in the array store are correct. I've heard that I shouldn't test against != EOF here before but my teacher has used that and I don't want to simply copy something I don't understand.
This is what is in congress.txt:
Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the government for a redress of grievances.
#include<stdio.h>
int processFile(int *store);
int cipher(int *store, int *code);
int main(void){
int store[300], code[300], i;
processFile(store);
for (i = 0; store[i] != 0; ++i){ //does a print test of store so I can see if the txt was stored properly
printf("%c", store[i]);
}
getchar();
return;
}
int processFile(int *store){
int i, a = 0;
FILE *f = fopen("congress.txt", "r");
for (i = 0; a != EOF;){
fscanf(f, "%c", &a); //store character in a
if (a <= 'Z' && a >= 'A'){ //store capital letters
store[i] = a;
i++;
}
if (a <= 'z' && a >= 'a'){ //store lower case letters as capital
store[i] = a - 32;
i++;
}
}
}