OK, I am talking about why some people, even experienced programmers, prefers a plural naming scheme of arrays/vectors instead of a singular naming scheme. I simply wonder why! I use the singular form because you always access a single object in the array. Look how stupid it looks when you say: apples[ i ].color = RED compared to apple[ i ].color = GREEN.
Singular array/vector naming scheme:
Code:
typedef struct Apple {
#define GREEN 1
#define YELLOW 2
#define RED 3
int color;
} Apple;
int main( ) {
#define APPLES 64
Apple apple[ APPLES ]; /* Singular array/vector naming scheme, because. . . */
int i;
for ( i = 0; i < APPLES; ++i )
apple[ i ].color = GREEN; /* . . .the access is of a single object! */
return 0;
}
Plural array/vector naming scheme:
Code:
typedef struct Apple {
#define GREEN 1
#define YELLOW 2
#define RED 3
int color;
} Apple;
int main( ) {
#define APPLES 64
Apple apples[ APPLES ]; /* Plural array/vector naming scheme, because? */
int i;
for ( i = 0; i < APPLES; ++i )
apples[ i ].color = RED; /* . . .yes that is my question. Why? */
return 0;
}