Try going through it mentally on a short string, say "abc".
a is index 0
b is index 1
c is index 2
getStringLen = 3
so, i starts at 3, which means i-1 is 2, which is the index of c.
i is decremented to 2, and i-1 is 1, which is the index b.
l is decremented to 1, and i-1 is 0, which is the index of a.
i is decremented to 0, but now the for-loop condition is false, and looping ends.
For signed integer types, you could equivalently do
for (long i = getStringLen-1; i >= 0; i--)
reversed += input[i];
but note that this would create an infinite loop for an unsigned type, such as size_t.