Ok, so I have been tasked with a simple assignment where I must write a program that creates an array of strings, where the number of rows is specified by the user. The program reads the data from input file and sorts the array by the last name.

This is what I have so far.

Code:
#include <stdio.h>
#include <stdlib.h>

//// PROTOTYPE DECLARATIONS ////
char **buildTable (void);
int readFile (void);

 

int main (void) //// BEGIN MAIN
{
	
	char **table = buildTable (); // <-CALL TO buildTable FUNCTION
	readFile(); // CALL TO readFile FUNCTION
	
	return 0;
}


char **buildTable (void)  //// BEGIN buildTable FUNCTION
{
	char **table;
	int rowNum, row;

	printf("Enter the number of rows in the table: \n");
	scanf("%d", &rowNum);
	table = (char **)calloc(rowNum +1, sizeof(char*));
	if(!table) return NULL;
	for (row = 0; row < rowNum; row++)
	table[row] = NULL;
	return table;
}

int readFile (void)  //// BEGIN readFile FUNCTION
{
	FILE *fpNames;

	if ((fpNames = fopen("lab4.txt", "r")) == NULL)
	{
	printf("\aERROR opening lab4.txt\n");
	return (100);
	
	
	}
	return 0;
}
So basically, I have a function to prompt the user to enter the amount of rows that he wants to see and that builds or allocates the memory for the array of strings. The next function opens the file and tests it to make sure it works. The question is this.

How do I read that file into the array of strings? I know that I have to make another function to fill the array, but I do not see how each module is going to communicate with each other.

Thanks in advance!!