Final Answer:
C program prompts the user to input a text file's name containing food availability information, reads and processes the file, and outputs available food items in a specific format. It utilizes arrays and file handling functions in C.
Step-by-step explanation:
```c
#include <stdio.h>
#include <string.h>
int main(void) {
const int MAX_LINES = 25; // Maximum number of lines in the input text file
const int MAX_STRING_LENGTH = 100; // Maximum number of characters in each column of the input text file
const int MAX_LINE_LENGTH = 200; // Maximum number of characters in each line of the input text file
char column1[MAX_LINES][MAX_STRING_LENGTH];
char column2[MAX_LINES][MAX_STRING_LENGTH];
char column3[MAX_LINES][MAX_STRING_LENGTH];
char column4[MAX_LINES][MAX_STRING_LENGTH];
char filename[MAX_STRING_LENGTH];
printf("Enter the name of the text file: ");
scanf("%s", filename);
FILE *file = fopen(filename, "r");
if (file != NULL) {
// Read the text file, extract columns, and output available food items
while (fscanf(file, "%s\t%s\t%s\t%s", column1[i], column2[i], column3[i], column4[i]) != EOF) {
if (strcmp(column4[i], "available") == 0) {
printf("%s (%s) -- %s\\", column2[i], column1[i], column3[i]);
}
}
fclose(file);
} else {
printf("Error opening the file.\\");
}
return 0;
}
```
In this program, the user is prompted to enter the name of a text file containing information about food items. The program then reads the file line by line, extracting information from each line based on tab-separated values.
If a food item is available, it outputs the relevant information in the specified format. This program utilizes arrays to store the different columns from the input file and incorporates file handling functions in C for reading and processing the text file.