title: How to have a higher level function check variables within lower functions via pass by reference?
body: <p>We haven't really covered pointers but have been learning about passing by reference (the <code>&amp;</code> pointer will be covered later). In an exercise, we were asked to write a small question game that would pass values in a simple one class <code>main</code> program between its functions to get things done. </p>
  
  <p>If we have a hierarchy where <code>main</code> calls 2 functions: function <code>askNum</code>, and function <code>giveStats</code>, with <code>askNum</code> having a host of functions inside (one on the lower level being <code>checkIfRight</code>). I need to call <code>giveStats</code> which would basically tell the user how well they've guessed over a set of questions. </p>
  
  <p>I am glossing over the details because I want to focus on the fact that we can't use value returning functions or global variables. So I have to figure out a way to count the number of guesses correct within <code>checkIfRight</code> and send that info back up the hierarchy of functions to <code>giveStats</code>. </p>
  
  <p>I am not sure how to call it though. I have most of the code figured out for this game and implemented simple <em>pass by reference</em> on functions in the same hierarchy, I am confused about having a function outside basically call it. So would there be a variable in main called <code>numCorrect</code> and <code>giveStats</code> would call it after <code>askNum</code> modifies it?</p>