
-----------------------------------
Prince Pwn
Mon Nov 23, 2009 11:54 pm

Passing Variable and Saving Changes
-----------------------------------
When I pass my variables (turtoisePos and harePos) through my MoveCreatures function, the work gets done inside the function but afterwards, the variable resets to it's default value. How can I fix this? 


/********************************
* Name:   Tortoise and the Hare *
* Author: 		    *
* Date:   11/23/2009			*
********************************/


// VARIABLE POSITIONS KEEP RESETTING, POINTER?? ----------------------

#include 
#include 
#include 
#include 

using namespace std;

// Prototypes
void MoveCreatures(string,string,string

-----------------------------------
Tony
Tue Nov 24, 2009 12:31 am

Re: Passing Variable and Saving Changes
-----------------------------------
When I pass my variables (turtoisePos and harePos)
No, you are passing your variables' values.

Remember -- Pass by value vs. Pass by reference.

-----------------------------------
Prince Pwn
Tue Nov 24, 2009 12:32 am

RE:Passing Variable and Saving Changes
-----------------------------------
OK.

Update: Thanks duh, it worked :D

Here's the code for those who want it:


/********************************
* Name:   Tortoise and the Hare *
* Author: 		    *
* Date:   11/23/2009			*
********************************/

#include 
#include 
#include 
#include 
#include 

using namespace std;

// Prototypes
void MoveAnimals(string,string,string
