You need to still track how many sticks are left with the variable sum, so:
Code:
#include <stdio.h>
int main ()
{
int rows[] = { 2, 4, 6};
int i, j,sum;
sum=rows[0]+rows[1]+rows[2];
while(sum>0) {
printf("\n\n\tWELCOME TO GAME OF NIM\t\n\n");
for(i = 0; i < 3,; i++)
{
printf("\nRow %d:", i+1);
for(j = 0; j < rows[i] ; j++)
{
printf("\t|");
}
printf("\t|");
}
//ask the user what row they want to pick sticks from
scanf() to get that number. (an int rowChosen)
//ask the user how many sticks they want to remove
scanf() to get that number. (an int sticksChosen)
rows[rowChosen+1] -= sticksChosen;
sum -= sticksChosen;
}
return 0;
}
And so on. Add in your player code, etc.