I thought I knew how the preprocessor worked until I ran until a recent problem.
Say I have the declaration below:
then later in my main function I haveCode:#define INFILE dataset
the file "dataset" exists with the number 5 in it.Code:FILE *fptr; int p; fptr = fopen("INFILE","r"); fscanf(fptr," %d",&p);
However when I run this I get a segmentation fault. So I'm thinking the preprocessor doesn't replace INFILE with dataset which I thought it did.
Can anybody explain to me what's going on?