how recursive works with passing reference variables

leetCode 62(unique paths):
A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the diagram below). How many possible unique paths are there?

solution: it’s easy to model as a math combination problem, assume the right-step has m; the down-step has n. so each path from top left to bottom right, has (m+n) steps totally. the total unique paths is C_(m+n)^m

passing by value:

1
2
3
4
5
int (int rm, int rn)
{
return rm==0 ? 1 : (rm+rn)/rm * sol(rm-1, rn);
}

what happened if rm-1 changed to rm–?

warning: unsequenced modification and access to 'rm'

what about passing as reference ?

1
2
3
4
int (int& m, int& n)
{
return m==0 ? 1 : (m+n)/(float)m * sol(--m, n);
}

if using m– :

error:  expects an l-value for 1st argument of sol(int&, int&)

m– is only r-value, can’t be used as reference varaible; but –m is r-value.

for m as a reference variable, –m is the way to update the content of the address. while m– more like move to the next address?