title: How would I keep totalCalc from resetting?
body: <p>I am making a program to calculate the most efficient amount of change to give when the user inputs a certain dollar value.</p>
  
  <p>The program worked before I tried to make it into functions, and when I tried to make my program more robust by using functions, the program isn't working as desired.</p>
  
  <pre><code>double getValueofCoins(int totalCalc, int coinValue, char* coinName) {
  
      double coinType;
  
      coinType = totalCalc / coinValue;
      totalCalc = totalCalc % coinValue; 
      printf("\n%s: %.0lf", coinName, coinType);
  
      return totalCalc;
  
  }
  
  
  
  int makeChange(int totalCalc) {
  
      double total;
  
      // calculate the most efficient amount of change
  
      getValueofCoins(totalCalc, 200, "Toonies");
      getValueofCoins(totalCalc, 100, "Loonies");
      getValueofCoins(totalCalc, 25, "Quarters");
      getValueofCoins(totalCalc, 10, "Dimes");
      getValueofCoins(totalCalc, 5, "Nickels");
      getValueofCoins(totalCalc, 1, "Pennies");
  
      return total;    
  }
  </code></pre>
  
  <p>What I want the code to do is give the most efficient amount of change (eg: if the user enters $20, it would say 10 toonies), but what it does is print the amount of each type of coin that would make up the value (eg: if the user enters $20, it would say 10 toonies, 20 loonies, 80 quarters, etc.)</p>
  
  <p>I think this is because the totalCalc variable is resetting to what the user inputted originally every time I call getValueofCoins(). How would I fix this?</p>