How to pass array "by reference" in C? : <p>This is what I'm trying to do but my code is either not compiling or giving me an unexpected output "BC" instead of just "B".</p>

<pre><code>#include &lt;stdio.h&gt;

void removeFirstAndLastChar(char** string) {
    *string += 1; // Removes the first character
    int i = 0;
    for (; *string[i] != '\0'; i++);
    *string[i - 1] = '\0';
}

int main(void) {
    char* title = "ABC";
    removeFirstAndLastChar(&amp;title);
    printf("%s", title);
    // Expected output: B
    return 0;
}
</code></pre>

<p>I looked through a lot of answers here related to passing pointers by reference but none of them seemed to contain the operations that I want to do in my removeFirstAndLastChar() function.</p>
