why array variable is getting updated : <p>I wrote this code and a part of this is not written by me and I'm not able to understand how a function is updating my <code>arrayData</code>?</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int *insert(int arr[], int size, int elem, int pos);

int main()
{
    // Create a array
    int arrayData[50] = {0};

    // Insert data
    for (int i = 0; i &lt; 10; i++)
    {
        arrayData[i] = i + 1;
    }

    int elem = 40, pos = 5, size = 10;

    // insert the element
    insert(arrayData, size, elem, pos);

    // show the data
    for (int i = 0; i &lt; size + 1; i++)
    {
        cout &lt;&lt; arrayData[i] &lt;&lt; " ";
    }

    return 0;
}

int *insert(int arr[], int size, int elem, int pos)
{
    size++;

    // shift elements forward
    for (int i = size; i &gt;= pos; i--)
        arr[i] = arr[i - 1];

    // insert x at pos
    arr[pos - 1] = elem;

    return arr;
}
</code></pre>

<p>OUTPUT:
<code>1 2 3 4 40 5 6 7 8 9 10</code></p>
