Last active
July 23, 2016 21:09
-
-
Save ShekharReddy4/b49ca17b792666d7c4adbe20b0cb882c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int* transpose_matrix(int **matrix, int order){ | |
int tmatrix[3][3]; | |
int i,j,k; | |
for ( i = 0; i < order; i++) { | |
for ( j = 0; j < order; j++) { | |
matrix[i][j] = tmatrix[j][i]; | |
} | |
} | |
return tmatrix; | |
} | |
void main() { | |
int order=3; | |
int matrix[3][3]; | |
int **tpointer; | |
int detofmatrix; | |
int i,j; | |
printf("enter the elements in the matrix\n" ); | |
for ( i = 0; i < order; i++) { | |
for ( j = 0; j < order; j++) { | |
scanf("%d",matrix[i][j]); | |
} | |
} | |
//detofmatrix = determinant(matrix,order); | |
//printf("determinant of the given matrix is : %d", detofmatrix); | |
printf("transpose of the given matrix is : \n"); | |
tpointer = transpose_matrix(matrix, 3); | |
for ( i = 0; i < order; i++) { | |
for ( j = 0; j < order; j++) { | |
printf("%d ", tpointer[i][j]); | |
} | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is a wrong approach, In c we cannot return the entire array by a function