You've got return total
in a function that returns void
. void
means that the function returns nothing.
Methinks you expect return total
to update the total
parameter in your call, but that's not the way it works.
Better go back to square one and read about value parameters and function results.