two-dimensional array not displaying proper output
<p>i want the user to input values in a 2 dimensional array. he can also choose the size of each dimension</p>

<pre><code>    int main()
{
    int x;
    int y;
    int *p;
    cout&lt;&lt;"How many items do you want to allocate in dimension x?"&lt;&lt;endl;
    cin&gt;&gt;x;
    cout&lt;&lt;"How many items do you want to allocate in dimension y?"&lt;&lt;endl;
    cin&gt;&gt;y;
    p = new int[x,y];
    for(int i=0; i&lt;x; i++)    //This loops on the rows.
    {
        for(int j=0; j&lt;y; j++) //This loops on the columns
        {
            int value;
            cout&lt;&lt;"Enter value: "&lt;&lt;endl;
            cin&gt;&gt;value;
            p[i,j] = value;
        }
    }
    drill1_4 obj;
    obj.CopyArray(p,x,y);

}
</code></pre>

<p>and then, ill output the two dimensional array via</p>

<pre><code>class drill1_4
{
public:
    void CopyArray(int*,int,int);
private:
    int *p;
};

void drill1_4::CopyArray(int* a,int x,int y)
{
    p = a;
    for(int i=0; i&lt;x; i++)    //This loops on the rows.
    {
        for(int j=0; j&lt;y; j++) //This loops on the columns
        {
            cout &lt;&lt; p[i,j]  &lt;&lt; "  ";
        }
        cout &lt;&lt; endl;
    }
    getch();
}
</code></pre>

<p>logic seems fine, but lets say, if the user enters the numbers, the array should look like this</p>

<p>1 2</p>

<p>3 4</p>

<p>but instead, it looks like this:</p>

<p>3 3</p>

<p>4 4</p>

<p>The array is not displaying it correctly.</p>
