if(player == 1)
player = 2;
else player = 1;
that piece of code should be at the bottom of your while loop. Like I said earlier, you have redundant code in your while loop. Take a look at it again, you basically copy and pasted the same code in your while loop, which defeats the purpose of having a loop in the first place. Ex) lines 138 to 183
P.S. Do you know anything about pointers? Right now you are having trouble with the rows being displayed correctly, that is because your variables are local to there respective functions. Meaning that row=row-rocknum gets reset back to the original row number after the function ends.