hi there,
I am writing a function that is suppose to calculate the total number of moves, a user gets by a spin of a dice. The game board has 25 spaces in all. Suppose on the first spin a user gets a 5, a message should come up saying "You have just moved 5 spaces". If on the next spin you get a 4,a message should come up saying that "You have moved 9 spaces". Unfortunately the code is not doing this. If the user got a 5 a message comes up saying " You have just moved 5 spaces". If a 6 comes up, the message says " You have just moved 6 spaces". Its not totaling it up.
Code:/* Purpose of this function is to keep track of the total numbers of spaces player2 moves in the game*/ int player1_move_spaces(int array1[],int die) //die represents the number that the user got when the dice was rolled { int num; num = num + die; array1[num]=num; printf("You have just moved %d spaces",num); return num; }