#include <stdio.h>
void transpose_matrix_4x4(float first[][4], float result[][4])
{
for (int j = 0; j < 4; j++)
{
for (int i = 0; i < 4; i++)
{
result[i][j] = first[j][i];
}
}
}
int main()
{
int a[4][4] = { {1, 3, 5, 7}, {4, 7, 1, 2}, {3, 4, 5, 6}, {4, 7, 5, 7} };
int result[4][4] = { 0, };
transpose_matrix_4x4(a, result);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
printf("%d ", a[i][j]);
}
printf("\n");
}
printf("\n");
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
printf("%d ", result[i][j]);
}
printf("\n");
}
return 0;
}
C, C++