#include
#define N 3
void zhuanzhi(int nums[][],int n);
int main()
{
int nums[N][N]={0};
int i,j,k=1;
printf("转置前效果:\n");
for(i=0;i
printf("\n");
for(j=0;j
nums[i][j]=k++;
printf("%2d ",nums[i][j]);}
}
zhuanzhi(nums,N);
printf("\n\n转置后效果:\n");
for(i=0;i
printf("\n");
for(j=0;j
printf("%2d ",nums[i][j]);
}
system("pause");
}
void zhuanzhi(int nums[][N],int n)
{
int i,j,tmp;
for(i=0;i
{
tmp=nums[i][j];
nums[i][j]=nums[j][i];
nums[j][i]=tmp;
}
}