**I have traced through the code 3 times but I still cant figure out the cause of the seg fault, I am trying to get a menu printed by opening files and displaying the contents in organized form, it so frustrating, I am already confused by my code and even more so by seg fault, any help would be highly appreciated, I know this will turn into a code review 
typedef struct{
   char item[30];
   char quantity[20];
   int calories;
   float protein;
   float carbs;
   float fats;
} food;
typedef struct {
   char month[4];
   int day, year;
} date;
int foodCount;   // counter variable to keep track of the number of foods that are chosen
  void initializeArray(FILE *dataFile, int arraySize, food foodType[]) // arrayProcessing.c
{
   int i;
// struct food foodType[arraySize];
   for(i=0;i<arraySize;i++)
   {
      scanf("%s",foodType[i].item);
      scanf("%s",foodType[i].quantity);
      scanf("%d",&foodType[i].calories);
      scanf("%f",&foodType[i].protein);
      scanf("%f",&foodType[i].carbs);
      scanf("%f",&foodType[i].fats);
   }
}
// used for the food arrays as well as the chosen foods
void printArray(int arraySize, food foodType[])                      // arrayProcessing.c
{
   int n;
   printf("FOOD ITEM%25s%9s%10s%8s%8s\n","QUANTITY","CALS","PRO","CARBS","FAT");
   for(n=0;n<arraySize;n++){
      printf("%d. %-20s\t%10s\t%3d\t%5.2f\t%5.2f\t%5.2f\n",n+1,foodType[n].item,foodType[n].quantity,
      foodType[n].calories, foodType[n].protein, foodType[n].carbs, foodType[n].fats);
   }
}
int printMainMenu()                                                  // menu.c
{
int choice;
    printf("\n MAIN MENU");
    printf("\n 1. choose lean protein");
    printf("\n 2. choose fruit");
    printf("\n 3. choose complex carbs (starches & grains)");
    printf("\n 4. choose fibrous carbs (veggies & greens)");
    printf("\n 5. choose dairy");
    printf("\n 6. choose fats, oils, nuts, seeds");
    printf("\n 7. show totals");
    printf("\n 8. quit program");
    scanf("%d", &choice);
    return choice;
int main (){
   int arraySize, choice;
   FILE *dataFile;
   food foodType[arraySize];
   do
   {
      choice=printMainMenu();
      switch(choice)
      {
         case 1: {
            dataFile=fopen("leanProteins.txt","r");
            fscanf(dataFile,"%d",&arraySize);
            initializeArray(dataFile, arraySize, foodType);
            printArray(arraySize, foodType);
      break;
      }
         case 2:{
            dataFile=fopen("fruit.txt","r");
            fscanf(dataFile,"%d",&arraySize);
            initializeArray(dataFile,arraySize, foodType);
            printArray(arraySize, foodType);
            break;
         }
         case 3:{
            dataFile=fopen("complexCarbs.txt","r");
            fscanf(dataFile,"%d",&arraySize);
            initializeArray(dataFile,arraySize,foodType);
            printArray(arraySize, foodType);
            break;
         }
         case 4:{
            dataFile=fopen("fibrousCarbs.txt","r");
            fscanf(dataFile,"%d",&arraySize);
            initializeArray(dataFile,arraySize,foodType);
            printArray(arraySize, foodType);
            break;
         }
         case 5:{
            dataFile=fopen("dairy.txt","r");
            fscanf(dataFile,"%d",&arraySize);
            initializeArray(dataFile, arraySize, foodType);
            printArray(arraySize,foodType);
            break;
         }
         case 6:{
            dataFile=fopen("fats.txt","r");
            fscanf(dataFile,"%d",&arraySize);
            initializeArray(dataFile, arraySize, foodType);
            printArray(arraySize,foodType);
            break;
         }
         case 7:{
            printf("show totals");
            break;
         }
         case 8:{
            exit(0);
         }
         default:
         printf("invalid selection!");
      }
   }while(choice!=8);
   return 0;
}
 
    