4 ms·
Fails on nested arrays. char *foo[10][20]; The method described would indicate that this is a array 10 of pointers to array 20s of chars. This is incorrect
by rntz 16y ago
Fails on nested arrays.
char *foo[10][20];
The method described would indicate that this is a array 10 of pointers to array 20s of chars.
This is incorrect. It is an array 10 of array 20s of pointers to chars.
- tordek 16y agoHow so? +-----------+ | +-+ | | ^ | | char *foo[10][20]; ^ ^ | | | +---+ | +---------------+ * foo is * an array of ten arrays of 20 * pointers to * char
- rntz 16y agoFollowing the procedure as written: +-------+ | +-+ | | ^ | | char *foo[10][20]; ^ ^ | | | +---+ | -----------+ It mentions, in rule 1, handling tokens of the form [] or [X], but not multiple occurrences of these. This is indeed rather nitpickish of me, but on the other hand, one thing that you at least need to know in that case is in what order you read the numbers - left-to-right, or right-to-left (is foo[10][20] a 10-array of 20-arrays or a 20-array of 10-arrays?). Not mentioning this leaves one (at least, it left me) with the impression that multiple occurrences were already handled by this rule as written, which is, as demonstrated, false.