Hey, so I'm making an iPhone app and in there is a common function that needs to be called. So I put it in it's own file and set it up, passing the parameters to that and all that. However, I'm not sure how best to return the values from the function. I read up trying to return the values in an array, but I'm not sure how to do it.
int EndOfTurn(int varTurns, int varFatness)
{
varTurns--;
if (varTurns <= 0) {
varFatness = varFatness - 5;
}
else {
varFatness += 2;
}
}
I need to return both varTurns and varFatness. However, this function will become more complicated, with me returning as many as 10 variables.
As of now, it is written in C, not Objective-C, (I just added a .c file to the Project), but I can change that. It needs to simply return all the updated values that I used in the function. If you could, write up the declaration of the function and the type:
TYPE_HERE EndOfTurn(int varTurns, int varFatness)
so I know exactly how to do it. Thanks, and I hope I gave enough info!