Dynamica alocation of an unknown matrix in C : I'm new to stack overflow, I've searched for the info available and I can't really find an answer to my question unless I'm just overlooking it.  

I need to take a file that is inputted by the user and multiply it by another file.  That much I know how to do.

the problem is one file is an array and the other is a matrix.  

I need to scan in the first line of the matrix to find the size of the matrix and I then need to dynamically allocate the matrix and array from the files.  

This is what I have so far

    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include <string.h>
    int main()
    {		
    	int row1, col1;
    		//These values need to be pulled from the first file//
    	char filename1[100];
    		//Seting the file name for entery and seting the limit to 100//
    	FILE* fp1;
    		//FILE must be set as a pointer (FILE must also be capitalized)//
    	
        printf("Enter file name including file extention: \n");
    		//This will pull in the name entered by the user//
        scanf("%s", filename1);
    		//Scans in the name of the first file//
    	
        fp1 = fopen(filename1, "r");
    		//This will open the file as entered by the user//
        if (fp1 == NULL)
        {
            printf("\nError, file not found\n");
    		exit(0);
        }
    		//This is for the first file//
    	
    	char filename2[100];
    		//Seting the file name for entery and seting the limit to 100//
    	FILE* fp2;
    		//FILE must be set as a pointer (FILE must also be capitalized)//
    	
        printf("Enter file name including file extention: \n");
    		//This will pull in the name entered by the user//
        scanf("%s", filename2);
    		//Scans in the name of the first file//
    	
        fp2 = fopen(filename2, "r");
    		//This will open the file as entered by the user//
        if (fp2 == NULL)
        {
            printf("\nError, file not found\n");
    		exit(0);
        }
    		//This is for the second file//
    	
    		//**I need to now dynamicaly allocate the input files**//
    	
    	return 0;
    } 

