 <p>You are forgetting the <code>if(i%2==0)</code> which is crucial. This line basically skips every second character. Then, the line you have identified can be split in 2 parts:</p> <pre><code>string[j]=string[i]; // Overwrite the character at position j j++; // Now increase j </code></pre> <p>The variable <code>i</code> keeps track of the position of the string you have reached while reading it; <code>j</code> is used for writing. In the end, you write 0 at position <code>j</code> to terminate the string.</p>