C code doubt please help: what should be the value for *len2?


#1
int ** solve(int A, int *len1, int *len2) {
int i,j;
int **arr = (int **)malloc(A * sizeof(int *)); 

     
for(i=0;i<A;i++)
{
    arr[i] = (int *)malloc((i+1) * sizeof(int));
    for(j=0;j<=i;j++)
    {
        if(j==0 ||j==i)arr[i][j]=1;
        else arr[i][j]=arr[i-1][j-1]+arr[i-1][j];
    }
}
*len1=A;
*len2=A;
return arr;
}

This is my code in c.Now for A=5 my output is [[1,0,0,0,0],[1,1,0,0,0],[1,2,1,0,0],[1,3,3,1,0],[[1,4,6,4,1]] instead of [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]. I know this is happenning due to *len2 value. But I don’t know what to put in there?Please help