Is this the correct method to pass an array to a function?
<p>This is the working program to pass an array in a function, but I am not able to understand that in the <code>print</code> function only the base address of the array is passed but still I am able to access the array with subscript <code>a[i]</code>. I know the correct method will be <code>*(a+i)</code> but why does it work with the subscript too?</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;conio.h&gt;
void print(int *a);
using namespace std;
int main()
{
    int arr[3]={1,2,3};
    print(arr);
    getch();
    return 0;
}
void print(int *a)
{
    for(int i=0;i&lt;3;i++)
    {
        cout&lt;&lt;a[i];//how we are able to access array with subscipt a[i]
    }
}
</code></pre>
