J
jaime
Hi all.
The source code download bundle for "Beginning C: From Novice to
Professional, Fourth Edition" (ISBN: 1590597354) (Horton/Apress)
contains a C source file (program9_09.c) which contains several instances
of the following type of idiom:
/* Program 9.9 REVERSI An Othello type game */
const int SIZE = 6;
int main(void)
{
char board [SIZE][SIZE] = { 0 };
return 0;
}
Now I'm a complete newbie with C (hence me reading this book), but I've had
a glance at "ISO/IEC 9899:TC2" and as far as I can tell:
1) "6.7.5.2 Array declarators Point 4" tells me that this must be a
"variable length array", and
2) "6.7.8 Initialization Point 3" tells me that initializers do not
initialize variable length arrays.
Could the panel please tell me:
a) Am I on the right track here?
b) Is the above C illegal? Something very similar appears to
have been overlooked several times in the thread at:
http://groups.google.com.my/group/comp.std.c/browse_thread/thread/2467e1e3a28a34a1/a5d4f798467dad19
c) Is the aforementioned book a known "lemon"? (Perhaps it's time for me
to try k&r2 again).
Thanks in advance to all. Jaime
The source code download bundle for "Beginning C: From Novice to
Professional, Fourth Edition" (ISBN: 1590597354) (Horton/Apress)
contains a C source file (program9_09.c) which contains several instances
of the following type of idiom:
/* Program 9.9 REVERSI An Othello type game */
const int SIZE = 6;
int main(void)
{
char board [SIZE][SIZE] = { 0 };
return 0;
}
Now I'm a complete newbie with C (hence me reading this book), but I've had
a glance at "ISO/IEC 9899:TC2" and as far as I can tell:
1) "6.7.5.2 Array declarators Point 4" tells me that this must be a
"variable length array", and
2) "6.7.8 Initialization Point 3" tells me that initializers do not
initialize variable length arrays.
Could the panel please tell me:
a) Am I on the right track here?
b) Is the above C illegal? Something very similar appears to
have been overlooked several times in the thread at:
http://groups.google.com.my/group/comp.std.c/browse_thread/thread/2467e1e3a28a34a1/a5d4f798467dad19
c) Is the aforementioned book a known "lemon"? (Perhaps it's time for me
to try k&r2 again).
Thanks in advance to all. Jaime