How to merge sort string array with using pointer in c? : <p>I'm learning merge sort in the string array. Here is my code :</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#define SIZE 10

int num = 0;

// Merges two subarrays of arr[]. 
// First subarray is arr[l..m] 
// Second subarray is arr[m+1..r] 

void merge(char str[SIZE][10], int l, int m, int r) { 
    int i, j, k; 
    int n1 = m - l + 1; 
    int n2 =  r - m; 

    /* create temp arrays */
    char L[n1][10], R[n2][10]; 

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i &lt; n1; i++) 
        strcpy(L[i], str[l+i]); 
    for (j = 0; j &lt; n2; j++) 
        strcpy(R[j], str[m+1+j]);

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray 
    j = 0; // Initial index of second subarray 
    k = l; // Initial index of merged subarray 
    while (i &lt; n1 &amp;&amp; j &lt; n2) { 
        num++;
        switch (strcmp(L[i], R[j])) {
            case -1 :
                strcpy(str[k], L[i]);
                i++;
                break;
            case 1 :
                strcpy(str[k], R[j]);
                j++;
                break;
        }

        k++; 
    } 

    /* Copy the remaining elements of L[], if there 
       are any */
    while (i &lt; n1) { 
        strcpy(str[k], L[i]);
        i++; 
        k++; 
    } 

    /* Copy the remaining elements of R[], if there 
       are any */
    while (j &lt; n2) { 
        strcpy(str[k], R[j]);
        j++; 
        k++; 
    } 
} 

/* l is for left index and r is right index of the 
   sub-array of arr to be sorted */
void mergeSort(char str[SIZE][10], int l, int r) { 
    if (l &lt; r) { 
        // Same as (l+r)/2, but avoids overflow for 
        // large l and h 
        int m = l+(r-l)/2; 

        // Sort first and second halves 
        mergeSort(str, l, m); 
        mergeSort(str, m+1, r); 

        merge(str, l, m, r); 
    } 
} 

/* UTILITY FUNCTIONS */
/* Function to print an array */
void printArray(char A[SIZE][10], int size) 
{ 
    int i; 
    for (i=0; i &lt; size; i++) 
        printf("%s ", A[i]); 
    printf("\n"); 
} 

int main(void) {

    int i, n;   
    char str[SIZE][10] = {"korea", "aaa", "computer", "seoul", "algorithm", "bbb", "ccc", "ddd", "game", "java"};
    char max[10];

    printf("Given array is \n"); 
    printArray(str, SIZE);

    mergeSort(str, 0, SIZE - 1);

    printf("\nSorted array is \n"); 
    printArray(str, SIZE);

    printf("횟수 : %d", num);

    return 0;
} 
</code></pre>

<p>The code above is working good. But I want to change <code>merge(char str[SIZE][10], int l, int m, int r)</code> and <code>mergeSort(char str[SIZE][10], int l, int r)</code>, <code>printArray(char A[SIZE][10], int size)</code> code to using double pointer like not <code>char str[SIZE][10]</code> but <code>char **str</code>. How do I change in this code?? I tried to change like that, but some error occurred... I have to change the code in <code>merge()</code> members that <code>char L[n1][10]</code> and <code>char R[n2][10]</code>.</p>
