I can't figure out why the output of this program is 0. How does the "&" sign cause this to happen? What exactly does it mean to pass arguments by reference? I don't know why I can't grasp this. Thanks for taking the time to read.
Passing by reference is handy because the value of the variable in the calling scope (main in this case) is changed. By the time printDigitsRef function is finished n is 0, the statement on line 19 reflects that.
If a variable is not passed by reference (that is by value) the function gets a local copy of that variable, the outer scope is not changed
This is a feature that allows one to change multiple values (the naive return more than 1 value scenario) by passing multiple arguments to a function, the functions parameters are declared as being references, as they are in your function.
There is more stuff about references, read about it in the tutorial and / or references material at the top left of this page.