#define FOO_COUNT 5 static const char *foo[] = { "123","456","789","987","654" };
通常迭代的方式,如一个例子,如下:
int i = FOO_COUNT; while (--i >= 0) { printf("%s\n",foo[i]);
反正有没有明确让人数统计5?将来我可能会添加/删除元素而忘记更新数组的大小,从而破坏我的应用程序.
int i = sizeof(foo)/sizeof(foo[0]);