Q:

Recovering colums/rows Matrix from a file

so i've this program that scan and print the matrix from a file. anyways the program i have works with normal matrix i mean Square matrix but now i want to make a manual matrix i mean i've to enter the number of lines/columns and then i call the lines and columns in the main.
So the program below explains the situation 
int recuperation (int t[][20], char *nomFichier){
    int nbElement=0 ,i,j,nbElement2=0;
    FILE *fp;
    fp=fopen(nomFichier,"r");
    if(fp!=NULL)
    {
        fscanf(fp,"%d\n",&nbElement);
        fscanf(fp,"%d\n",&nbElement2);
        if(nbElement && nbElement2)
        {
            for(i=1;i<=nbElement;i++)
            {
               for(j=1;j<=nbElement2;j++)
               {
                   fscanf(fp,"%d",&t[i-1][j-1]);
               }

            }
        }
    }
    else
        printf("\n Fichier vide \n");
    return nbElement;
}

You see the return? nbElement that's the number of lines but i want to return the number of columns too, which is nbElement2.
Because later in main() i've to call this function by typing:
l= recuperation(t,txtfile)
but i can't call the columns since i returned only 1 value.
Hope that you got what i mean, thanks.

A:

The best thing to do is to provide the columns and rows as pointers to the function. This way, when you assign values to those variables, they change outside of the function too. 
int recuperation (int t[][20], char *nomFichier, int * rows, int * columns){
    int i,j;
    FILE *fp;
    fp=fopen(nomFichier,"r");
    if(fp!=NULL)
    {
        fscanf(fp,"%d\n",rows);
        fscanf(fp,"%d\n",columns); // already a pointer
        if(*rows && *columns) // dereference the pointer to get the value
        {
            for(i=1;i<=*rows;i++)
            {
               for(j=1;j<=*columns;j++)
               {
                   fscanf(fp,"%d",&t[i-1][j-1]);
               }

            }
        }
    }
    else
        printf("\n Fichier vide \n");
    return 0;
}

