#include
<stdio.h>
#include <stdlib.h>
int conver(int n, int **A);
int main(void)
{
int n;
printf("Please input the dimension of Array A: ");
scanf("%d", &n);
printf("Please input the elements: ");
int **A = (int **)malloc(n * sizeof(int *));
for (int m = 0; m < n; m++)
A[m] = (int *)malloc(n * sizeof(int));
int i, j;
for (i = 0; i < n; i++)
{
for (j=0; j<n; j++)
{
scanf("%d", &A[i][j]);
}
}
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
printf("%d\t", A[i][j]);
}
printf("\n");
}
conver(n, A);
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
printf("%d\t", A[i][j]);
}
printf("\n");
}
for (i = 0; i < n; i++)
{
free(A[i]);
A[i] = NULL;
}
free(A);
A = NULL;
return 0;
}
int conver(int n, int **A)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; i>j; j++)
{
int temp = A[i][j];
A[i][j] = A[j][i];
A[j][i] = temp;
}
}
return 0;
}