#include <stdio.h>
#include <stdlib.h>
main()
{
int i, j;
unsigned int m, n;
int *p = NULL;
printf("Please input the matrix dimension:\n");
printf("m = ");
scanf("%d", &m);
printf("n = ");
scanf("%d", &n);
printf("Please input the matrix data:\n");
p =(int*)malloc(sizeof(int) * m * n);
for(i = 0; i < m; i++)
{
printf("Row %d\n", i);
for(j = 0; j < n; j++,p++)
scanf("%d", p);
}
p = p - m * n;
for(i = 0; i < m; i++)
{
for(j = 0; j < n ; j++, p++)
printf("%6d\t", *p);
printf("\n");
}
p = p - m * n;
free(p);
}