Two-dimensional string array counts the number of arrays. Is this requirement strange? Not very strange. Some people say that the macro definition of 8 above is not enough. Adding one and subtracting one each time seems to be OK, but it is not boring. I like to use this method. After all, I have the final say in my code.
char xxxxxxxxxxxxName[8][32]{
"xxx",
"xxxxx",
"xxxxxx",
"x",
"xx",
"xxxxxxxxxx",
"xxxxxxxxxxxx",
"xxxxxxxxxxxxxx",
};
int nTotal = sizeof(xxxxxxxxxxxxName) / sizeof(xxxxxxxxxxxxName[0]);
If it is a structure, it is similar. The above is a string array. If it is a structure, just divide it by the size of the structure.