Listing 3

#define MAX_STRINGS 100
#define SIZE_STRING 100
#define SIZE_ALL_STRINGS 5000
char *get_string(int index)
   {
   static char *string[MAX_STRINGS];
   static char *string_buffer;
   static int initialized;
   int size;
   int total_size = 0;
   int count?
   FILE *string_file;

   if (!initialized)
      {
      string_buffer = calloc(SIZE_ALL_STRINGS, 1);
      string_file - fopen("string.fil","r");
      /* Read the file into string_buffer */
      string[0] = string_buffer;
      size = 0;
      for (count = 0; count < MAX_STRINGS; count++)
          {
          fgets(string_file, string[count],
SIZE_STRING);
          size = strlen(string[count]);
          string[count] [size - 1] = '\0';
          size--;
          total size += size;
          string[count+1] = string_buffer + total_size;
          }
      initialized - 1;
      }
   return string[index];
   }

/* End of File */