#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define ROW 5
//输出3行2列的矩阵
void Show(int brr[3][2],int row,int col)//(*brr)[2]相当于brr[3][2]
{
for(int i = 0;i < row;i++)
{
for(int j = 0;j < col;j++)
{
printf("%d ",brr[i][j]);
}
printf("\n");
}
}
int main()
{
int brr[3][2] = {1,2,3,4,5,6};
Show(brr,3,2);
getchar();
return 0;
}
//2行3列矩阵转换成3行2列矩阵
//void Chage(int (*brr)[3],int (*crr)[2],int row,int col)
//{
// for(int i = 0;i < row;i++)
// {
// for(int j = 0;j < col;j++)
// {
// crr[j][i] = brr[i][j];
// }
// }
//}
//void Show2(int *brr,int row,int col)
//{
// for(int i = 0;i < row;i++)
// {
// for(int j = 0;j < col;j++)
// {
// printf("%2d ",brr[i*col+j]);
// }
// printf("\n");
// }
//}
//int main()
//{
// int brr[2][3] = {1,2,3,4,5,6};
// int crr[3][2] = {};
// Chage(brr,crr,2,3);
// S
C语言:矩阵专题
最新推荐文章于 2023-11-08 07:00:00 发布