printing a vector in c++
<p>I am new to C++ and I made a function that reads elements in a vector and a function that prints the elements. The problem is that the print function doesn't work well.</p>

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

<p>1)</p>

<pre><code>int read()
{
    int elements,i;
    cout&lt;&lt;"Give the number of elements:";
    cin&gt;&gt;elements;
    int v[elements];
    for(i=1;i&lt;=elements;i++)
    {
        cout&lt;&lt;"v["&lt;&lt;i&lt;&lt;"]=";
        cin&gt;&gt;v[i];
    }
    return elements;
}
</code></pre>

<p>2)</p>

<pre><code>void print_vector(int elements)
{
    int i;
    int v[elements];
    for(i=1;i&lt;=elements;i++)
    {
        cout&lt;&lt;v[i];
    }
}

int main()
{
    int n=read();
    print_vector(n);
    return 0;
}

Example:
Give the number of elements:5
v[1]=1
v[2]=2
v[3]=3
v[4]=4
v[5]=5
1348
</code></pre>

<p>It prints 1348 instead of 12345. What is wrong with the function and how can I modify it to print the right elements?</p>
