You can easily do inplace transposition of a matrix, whether it's sparse or not:
its a sparse matrix and the function should turn it into the transposed matrix.
Simply substitute array subscripts with the appropriate set-/get-functions, maybe something along the lines of
for(i = 0; i < ROWS; i++)
for(j = 0; j < COLS; j++)
A[i][j] = A[j][i];
If efficiency is a concern, don't use linked data structures for storing matrices.
matrix_set(A, i, j, matrix_get(A, j, i));
EDIT: now that I posted the question, I can see the problem. For matrices where ROWS != COLS, this doesn't work as easily. Let me start a new post...