Try unpacking the brackets on different levels of indentation:
temp[ // get this index in temp
-- // decrement by 1
countArray[ // get this index in countArray
getDigit(position, input[tempIndex], radix) // call getDigit()
]
]
In human-readable terms, it calls getDigit()
to index into countArray
, then decrements that value and uses it to index into temp
.
The decrement operator --x
is different from x--
because of what it returns. By the end of the operation, x
always ends up as one less than it was, but --x
returns the new value of x
, while x--
returns the old value of x
from before it was decremented. The same applies for ++x
and x++
.