I'm attempting to create a 3x3 table in C++, but the last value of each row is being replaced with the first value of the row above.
#include<iostream>
#include<iomanip>
#include<fstream>
using namespace std;
void fillArray(int *arrayRow1, int *arrayRow2, int *arrayRow3)
{
    cout << "Enter the number for row 1 column 1: " << endl;
    cin >> arrayRow1[0];
    cout << "Enter the number for row 1 column 2: " << endl;
    cin >> arrayRow1[1];
    cout << "Enter the number for row 1 column 3: " << endl;
    cin >> arrayRow1[2];
    cout << "Enter the number for row 2 column 1: " << endl;
    cin >> arrayRow2[0];
    cout << "Enter the number for row 2 column 2: " << endl;
    cin >> arrayRow2[1];
    cout << "Enter the number for row 2 column 3: " << endl;
    cin >> arrayRow2[2];
    cout << "Enter the number for row 3 column 1: " << endl;
    cin >> arrayRow3[0];
    cout << "Enter the number for row 3 column 2: " << endl;
    cin >> arrayRow3[1];
    cout << "Enter the number for row 3 column 3: " << endl;
    cin >> arrayRow3[2];
    cout << "Resulting Table:" << endl;
    cout << "_______" << endl;
    cout << "|" << arrayRow1[0] << "|"  << arrayRow1[1]  << "|" << arrayRow1[2] << "|" << endl;
    cout << "________" << endl;
    cout << "|" << arrayRow2[0] << "|"  << arrayRow2[1]  << "|" << arrayRow2[2] << "|" << endl;
    cout << "________" << endl;
    cout << "|" << arrayRow3[0] << "|"  << arrayRow3[1]  << "|" << arrayRow3[2] << "|" << endl;
    cout << "_______" << endl;
    
    
}
int main(){
int arrayRow1[2], arrayRow2[2], arrayRow3[2];
fillArray(arrayRow1, arrayRow2, arrayRow3);
}
When 1, 2, 3, 4, 5, 6, 7, 8, 9 is entered it resulting the the following output:
________
|1|2|4|
________
|4|5|7|
________
|7|8|9|
________
The expected output is:
________
|1|2|3|
________
|4|5|6|
________
|7|8|9|
________
What is cause this issue?
 
     
    