CompuServe Messages

#char (*tp[N])[] ?

    15-Aug-93 10:22:12
Fm: Doug Walker 71165,2274
To: Jeff Pratt 76057,3645
Jeff, Here's another neat trick if and only if the size of the arrays is needed in the same file that they are defined: char *strings[] = {"A", "B", "C"}; #define NSTRINGS (sizeof(strings)/sizeof(char *)) This will automatically update the NSTRINGS define if you add strings. The sizeof() expression is evaluated at compile time, so it doesn't add to the size of your program. Note that you CAN'T use this method if you are declaring the data item as an extern and not specifying a number inside the []. –Doug