I am compiling my int main, of which the top portion looks like this:
int main()
{
    FILE *sourceFile;
    sourceFile = fopen("biodata.dat", "r");
    
    if(sourceFile == NULL)
    {
            printf("Invalid input file.");
            system("PAUSE%26gt;NUL");
            return 0;
    }
    
    
    int sizeget = 0;
    fscanf(sizeget);
    const int SIZE = sizeget;
    
    char type[SIZE];
    double sum = 0;
    int count = 0;
    double test = 0;
    double temp[SIZE];
    char date[12];
... etc etc....
}
Whenever I compile it, I get this error:
C:\Program Files\Miracle C\none.c: line 19: Parse Error, expecting `'}''
'int sizeget = 0'
aborting compile.
If I just insert a random } above it, I get this error message:
C:\Program Files\Miracle C\none.c: line 20: cannot redeclare function
'fscanf(sizeget)'
aborting compile
No idea what's going on... is there some glaring error in my code that I am missing? Any help is appreciated!
A baffling (and probably simple) error in C?
syntax fscanf
fscanf( sourcefile, "%d", %26amp;sizeget);
// hope this helps
Reply:Some compilers don't permit declaring variables in anywhere but immediately after an opening brace '{'.
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment