Re^2: initializing an array
Maarten Litmaath
maart at cs.vu.nl
Wed May 10 03:39:09 AEST 1989
matthew at sunpix.UUCP ( Sun Visualization Products) writes:
\In article <12814 at ut-emx.UUCP>, reeder at ut-emx.UUCP (William P. Reeder) writes:
\...
\| int a[][] = {
\| { 1, 2, 3 },
\| { 4, 5, 6 },
\| { 7, 8, 9 }, <------ remove this excess ','
^^^^^^
Bullshit!
\| };
\|
\| It is possible to determine from the syntax how many elements there
\| are in each dimension, but my compiler complains about a null
\| dimension.
It is NOT possible! Compare with the following LEGAL code:
int a[][5] = {
{ 0, 1, 2 },
};
\Of course it going to complain about a null dimension. You've got an extra ','
\in the initializer declaration.
Nonsense! The extra comma is perfectly valid. Try figure out why this feature
was added to the language! Hint: can you say `code generator'?
People: PLEASE verify your `solutions' before posting.
--
"If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam:
it's probably wrong." (jim at bilpin) |maart at cs.vu.nl, mcvax!botter!maart
More information about the Comp.lang.c
mailing list