typedef, define and array

when I'm using something like
1
2
3
#define DIR_TOTAL        4;
...
typedef int T15Array[DIR_TOTAL][DIR_TOTAL];

istead of
typedef int T15Array[4][4];
I have pointless error messages. How should I do it properly?
I don't see any reason why that wouldn't work. What error message(s) are you getting?

Also -- don't use #define. use a const int instead:

 
const int DIR_TOTAL = 4;
1>c:\my documents\visual studio 2008\projects\fifteen\fifteen\fifteen.h(26) : error C2143: syntax error : missing ')' before ';'
1>c:\my documents\visual studio 2008\projects\fifteen\fifteen\fifteen.h(26) : error C2143: syntax error : missing ']' before ')'
1>c:\my documents\visual studio 2008\projects\fifteen\fifteen\fifteen.h(26) : error C2143: syntax error : missing ';' before ')'
1>c:\my documents\visual studio 2008\projects\fifteen\fifteen\fifteen.h(26) : error C2059: syntax error : ')'
1>c:\my documents\visual studio 2008\projects\fifteen\fifteen\fifteen.h(26) : error C2059: syntax error : ']'
1>c:\my documents\visual studio 2008\projects\fifteen\fifteen\fifteen.h(26) : error C2143: syntax error : missing ')' before ';'
1>c:\my documents\visual studio 2008\projects\fifteen\fifteen\fifteen.h(26) : error C2059: syntax error : ']'

errors with typedef int T15Array[DIR_TOTAL][DIR_TOTAL];

thanks for reply, everything fine with const instead #define
Last edited on
Line 1 should be without ;
thanks, with #define DIR_TOTAL 4 also works :)
Topic archived. No new replies allowed.