Please tell me this is what you meant
Code:
#include<stdio.h>
#include <stdlib.h>
int main (void)
{
int row_size1,col_size1,row_size2,col_size2;
int **A;
int i = 0, j = 0;
//allocate space for 1 matrix
// A = malloc(1 * sizeof (int *));
scanf("%d %d",&row_size1,&col_size1);
A= malloc(row_size1*sizeof(int*));
for(i=0;i<row_size1;i++)
{
A[i]=(int*)malloc(col_size1*sizeof(int));
}
A = malloc(1 * sizeof (int *));
printf("Enter the elements of the first matrix write 99 when done:");
for(i=0;i<row_size1;i++)
{
for(j=0;j<col_size1;j++)
{
scanf("%d",&A[i][j]);
if (A[i][j] == 99) // 'x' is character variable I declared to \
break;
}
}
printf("The required matrix is\n");
for(i=0;i<row_size1;i++)
{
for(j=0;j<col_size1;j++)
printf("%d ",A[i][j]);
printf("\n");
}
for(i=0;i<row_size1;i++)
{
free(A[i]);
}
free(A);
}