Posted By:
21 Jun, 2013 9:23 am PDT

Arrays in C

How to transpose a matrix?
Attachment:None


Transposing a matrix is interchanging rows and columns of a matrix. Suppose we have a matrix 

1 2 3
4 5 6

After transposing we would now have

1 4
2 5
3 6

The part of code responsible for transposing the matrix is

for( c = 0 ; c < m ; c++ )

{

    for( d = 0 ; d < n ; d++ )

    {

        transpose[d][c] = matrix[c][d];

    }

}

Watch the video

Was it useful?  




Please login to reply to this problem.