What does happen when we equation two pointer in C?
<p>This is a C code to sort the substrings of a large string starting from each index but I cannot understand how can we sort the array a in the code. </p>

<p>As far as I understand: </p>

<ul>
<li>we refer <code>a[i]</code> to <code>&amp;c[i]</code> and thus it created n arrays but doesn't
<code>&amp;a[i][1] == &amp;a[i+1][0]</code>?</li>
<li><p>Since <code>a[i] = &amp;c[i]</code>, is it true that <code>&amp;a[i][0] == &amp;c[i]</code>?</p></li>
<li><p>If not, this looks like a faster way to create n(length of original
string) arrays, without actually copying it. Is that true?</p></li>
</ul>

<p>My code  </p>

<pre><code>#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
#define M 1
#define MAXN 5000000
char c[MAXN], *a[MAXN];
int pstrcmp(char **p, char **q){ 
    return strcmp(*p, *q); 
}
int main(){ 
    int i, ch, n = 0, maxi, maxlen = -1;
    while ((ch = getchar()) != EOF) {
        a[n] = &amp;c[n];
        c[n++] = ch;
    }
    c[n] = 0;
    qsort(a, n, sizeof(char *), pstrcmp);
    printf("%s",a[1]);
    return 0;
}
</code></pre>