How do I return a variable so I can use it in another function in C++?
<p>This is a stupid question, but honestly I can't get it to work in my program. I just started C++ and I keep doing it wrong. I have the user enter in the value of 'pile' and then i want to go over to my second function and divide pile by two. My professor says I'm not allowed to use global variables. Here's my code:</p>

<pre><code>int playerTurn();
int main() //first function
{
    int pile = 0;
    while ( pile &lt; 10 || pile &gt; 100 ) {
        cout &lt;&lt; "How many marbles would you like there to be?" &lt;&lt; endl;
        cout &lt;&lt; "Please choose between 10 and 100: ";
        cin &gt;&gt; pile;
    }
    return pile; //the variable I'm trying to return is pile
    playerTurn();
}

int playerTurn(pile) //second function
{
    int limit = pile / 2; //says pile is an undeclared identifier
}
</code></pre>

<p>I can't seem to get the 'pile' over to my other function, playerTurn</p>
