Following on from this discussion: http://www.8052.com/forum/read.phtml?id=84814 Keil C51 v7.50 rejects the following:
char key_tbl[][] = { { 4, 3, 2, 1 }, // row 0 { 8, 7, 6, 5 }, // row 1 { 12, 11, 10, 9 }, // row 2 { 16, 15, 14, 13 }, // row 3 };
MAIN.C(27): error C163: 'key_tbl': unknown array size
There's a draft copy of the C9x spec here: Careful there. That draft copy is a dangerous document to quote, these days. The document being drafted there is no longer in draft status, and there are non-negligible differences between the draft and the real thing. But that's not the worst of it. That document describes C99, but C51 doesn't even try to be C99 compliant (yet), so neither this draft nor the actual standard document that it eventually became, can meaningfully be applied to this problem. And I'm quite sure that C90 never allowed [][] arrays.
"That document describes C99, but C51 doesn't even try to be C99 compliant" I couldn't actually find a specific reference here or in the Manuals as to precisely what "ANSI" Keil C51 complies to? But, yes; I'm sure it's not C99. However, ISO/IEC 9899:1990 does contain nearly all of the words cited from that C99 draft (and differs from the book). The language is pretty opaque, but it does seem to be implying that it ought to work...? "And I'm quite sure that C90 never allowed [][] arrays." That's what I thought - and for the reasons already provided here.