Hey my code is intended to take in an encrypted message and key then decrypts it.

Firstly the lines would have to be read column wise then rearrange based on the reconstruction of the key. So if the message was encrypted with "jmpu" then it has to be decrypted by "jump". The problem I am having is the swapping the columns. i tired sorting the key then trying to swap based on is the current letter in the key is >= the sorted key.
Code:
char *transpose(char *message, char *key);
char *sorting(char *string);
int main()
{
    char sentence[100]="Tqkofeibnx-cr--hu-wo";
    char key[100]="jump";
    transpose(sentence, key);
     
   /* how it should be read into a matrix(the key is not read into the matrix):
    J M P U     
    T e - h    
    q i c u     
    k b r -       
    o n - w       
    f x - o    
   
    how it should be arranged
    J U M P           
    T h e - 
    q u i c
    k - b r 
    o w n -
    f o x -
   
    then read row by row
*/

    return 0;
}
char *transpose(char *message, char *key)
{
    int i,j,k,index;
    //len of message
    int message_len=strlen(message);
    //column len
    int col_len=strlen(key);
    //give us the number of rows
    int row_len =message_len/col_len;
    if(message_len%col_len)
    {
        row_len++;//increments row_len
    }
    char matrix[row_len][col_len];
    //creat matrix
    k=0;
    for(i=0;i<col_len;i++)
    {
        for(j=0;j<row_len;j++)
        {
            matrix[j][i]= message[k++];
        }
    }
    
    //remove padding
    for(i=0;i<col_len;i++)
    {
        for(j=0;j<row_len;j++)
        {
            if(matrix[j][i]=='-'||matrix[i][j]=='\0')
            {
                matrix[j][i]=' ';
            }
            
        }
    }
    //print matrix above
    for(i=0;i<row_len;i++)
    {
        for(j=0;j<col_len;j++)
            {
                printf("%c ",matrix[i][j]);
            }
        printf("\n");
    }


    //columnuar transpose
    char *dmessage = malloc(sizeof(char)*(row_len*col_len));
    *dmessage ='\0';
    k=0;
    char temp[col_len];
    strcpy(temp,key);
    char *sortedkey= sorting(temp);
    
        //need help at this point
    for(index=0; index<strlen(key);index++)
    {
        for(i=0;i<col_len;i++)
        {
            for (j=0;j<row_len;j++) 
            {
                if(sortedkey[index]>=key[i])
                {
                    dmessage[k++]=matrix[j][i];
                }
                dmessage[k]='\0';
            }
        }
    }
    
    printf("\nDecrypted message is\n");
    for (i=0;dmessage[i]!='\0';i++) 
    printf("%c",dmessage[i]);
    printf("\n\n");


}




char *sorting(char *string)//sort alphabetically 
{
    
    char temp;
    int i, j;
    int str_len = strlen(string);
    for (i = 0; i < str_len-1; i++) {
        for (j = i+1; j < str_len; j++) {
            if (string[i] > string[j]) {
                    temp = string[i];
                    string[i] = string[j];
                    string[j] = temp;
            }
        }
    }
    
    return string;
}