Why doesn't GCC like it?
I am trying to learn C and find myself very stuck, no complaints :)
Anyway, I wrote a program and GCC doesn't like it. The following code is NOT a program, but it demonstrates the problem:
#define MAXLINE = 1000
int main()
{
int tmp = MAXLINE;
char line[MAXLINE];
return 0;
}
When it is compiled I get the following error:
test.c: 7: error: expected expression before '= token
If you replace the symbolic constant MAXLINE with int 1000, everything works.
What's happening?
+2
rhr
source
to share
7 replies
You have
#define MAXLINE 1000
You can read more here http://gcc.gnu.org/onlinedocs/cpp/Object_002dlike-Macros.html#Object_002dlike-Macros
+3
user173973
source
to share