Understanding complex pointer sample code in C
<p>I am trying to understand the following snippet of a sample pointer program, not sure if it's possible to ask these questions, I'll delete if it isn't! </p>

<pre><code>void f1(char *s) {
    char *p, *q;
    for (p=q=s; *p != '\0'; p++) {
        if ((*p &gt;= 'A' &amp;&amp; *p &lt;= 'Z') || (*p &gt;= 'a' &amp;&amp; *p &lt;= 'z'))
            *q++ = *p;
        else if (q &gt; s &amp;&amp; *(q-1) != '\n')
            *q++ = '\n';
    }
    *q = '\0';
}
</code></pre>

<p>I understand there are three pointers p, s and q, but I'm not sure what <code>p=q=s</code> entails? Is it checking if both pointers p and q are between <code>char</code> a-z (one is lower case the other is upper case) and iterating through the letters? </p>

<p>Any help would be appreciated!</p>