Memory Management of Variables on iPhone
<p>I know this is a basic questing but I am just not finding a good answer.  I have a app with multiple view controllers and I have noticed that if a create a variable and take action on it in one controller:</p>

<pre><code>int foo = 0;
foo =+ 1;
</code></pre>

<p>I can declare the variable in another controller without initializing it's value it will carry the value it was last set to in the previous view controller:</p>

<pre><code>int foo;
if (foo == 1)
    doSomething;
</code></pre>

<p>I have used this to my advantage for keep track of the current player in a multi player game etc... using the data in multiple controllers as their views are loaded and removed.  I am new to Obj C and based on what I have been reading this does not seem like the right way to to things.</p>

<p>So here is my question, is this a safe way to pass data between controllers and if not what should I be doing?</p>
