I am manipulating the row and column within a user-defined function called dropmove, and I am currently stuck on the method of passing and returning the array cell/value into my global array. I am getting conflicting results on how I need to return the cell. Do I need to call a pointer, or can I pass it by value since it is a single cell? If I want to manipulate my row and column value later on, will pass-by value fail to return the value of the cell row and col?
From what I tried in the past, it has seemed to be hit or miss. In one test, I saw that I printed the cell values in the correct orientation. That gives me some rest, but I want absolute surety that I am going down the right path.
Here is a minimal portion of my code below.
int row;
int column;
int myrowcol[8][8] = {{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
};
int dropmove()
{
mycol[row][column] = selectPlayer();
column = column;
for (int row = 0; row <= 7; row ++)
{
if (row == 0 || myrowcol[row + 1][column] != 0)
{
myrowcol[row][column] = selectPlayer();
if (myrowcol[row][column] == 0)
{
column = 0;
}
return myrowcol[row][column];
}
}
}
int main()
{
dropmove();
}