My task is to make a 2D array 2xn from values given in A and B which have n elements.
I found this way to allocate memory for 2D array and it works but I don't understand if or why it is correct
int **tab2D(int A[],int B[],int n)
{
    int **newTab = malloc(n*sizeof(int*));
    newTab[0] = A;
    newTab[1] = B;
    return newTab;
}
I know there are other ways to do this but I'm curious about this one.
 
     
    