0

I have the following code, the arrays are global variables.

#define MEMORY 64000;
#define NUMFRAMES 6400;

int mem[MEMORY];
int frames[NUMFRAMES];

I was pretty sure this should work as I don't see why it shouldn't but I am getting "parse error before ';' token" for both array declarations.
Although if I declare the arrays using 64000 instead of MEMORY it works.

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Narue
0

It's best to think of the preprocessor as a completely different language than C. In particular, #define statements do not generally end with a semicolon because the semicolon is considered to be a part of the replacement text. This is what your compiler sees:

int mem[64000;];
int frames[6400;];

At which point the error is easy to locate.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.