CompuServe Messages

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

    18-Aug-93 15:12:46
Fm: Greg Comeau@Comeau Cmptg 72331,3421
To: Jeff Pratt 76057,3645
>char *fruits[NF] = {"Apples", "Oranges", "Bananas"}; >char *vegetables[NV] = {"Carrots", "Brocoli", "Turnips", "Rutabagas"}; >char **plants[NP] = { fruits, vegetables }; Right. The issue is that fruits is of type 'char *[NF]' and vegatables is of type 'char *[NV]'. In certain contexts both these type can collapse into char **, which is what each plants[?] is. >int nkinds[NGROUPS] = { NV, NP }; But this is most always a mistake waiting to happen. Why? One should generally avoid referring to constants at almost all costs and one should generally avoid even referring to named constants unless practical or necessary, especially names constants of this sort (certainly I'm not taking about something like PI here…).