Listing 2

#include <stdio.h>

#define NUMELEM(a) (sizeof(a)/sizeof(a[0]))

char *command[] = {
   "ADD",
   "DELETE",
   "LIST",
   "REPLACE"
};

main()
{
   int i;

   for (i = 0; i < NUMELEM(command); ++i)
      printf("command[%d]: %s\n", i, command[i]);
}



   Output:

   command[0]: ADD
   command[1]: DELETE
   command[2]: LIST
   cammand[3]: REPLACE