int main()
{ int n; printf("Enter n: "); scanf("%d",&n); int **matrix=(int**)malloc(sizeof(int)*n); for(int i=0;i<n;++i) matrix[i]=(int*)malloc(sizeof(int)*n); printf("Init matrix.\n"); Init(matrix,n); printf("Reverse operating.\n"); Reverse(matrix,n); printf("Display the matrix after revesing.\n"); Print(matrix,n); return 0; } void Reverse(int **matrix,int n)
{ for(int i=0;i<n;++i) for(int j=i;j<n;++j) if(i!=j) { int temp=matrix[i][j]; matrix[i][j]=matrix[j][i]; matrix[j][i]=temp; } } |