Difference between char** and char[][] : <p>I am trying to sort strings using stdlib qsort. I have created two sort functions sort1 and sort2. sort1 input argument is char** and sort2 input argument is char[][]. My program crashes when use sort1 function to sort array of strings.</p>

<pre><code>#include "stdafx.h"
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;


int compare(const void* a, const void* b)
{
    const char *ia = (const char *)a;
    const char *ib = (const char *)b;
    return strcmp(ia, ib);
}

//program crashes
void sort1(char **A, int n1) {

    int size1 = sizeof(A[0]);
    int s2 = n1;
    qsort(A,s2,size1,compare);
}

//works perfectly
void sort2(char A[][10], int n1) {

    int size1 = sizeof(A[0]);
    int s2 = n1;
    qsort(A,s2,10,compare);

}

int _tmain(int argc, _TCHAR* argv[])
{

     char *names_ptr[5] = {"norma","daniel","carla","bob","adelle"};
     char names[5][10] = {"norma","daniel","carla","bob","adelle"};
     int size1 = sizeof(names[0]);
     int s2 = (sizeof(names)/size1);    
     sort1(names_ptr,5); //doesnt work
     sort2(names,5); //works
     return 0;
}
</code></pre>
