I couldn’t understand this part
arr[name.Length – i] = name[i – 1];
Let us have a name of 5 characters. so the value of the arr will be 4, right?
then in the loop, the looping variable is also taking the same length, so its initial value will be 4 too.
in the first iteration, the value of arr[4 – 4] will be arr and name[4 – 1] will be name
so the first index of arr is copied with the fourth index of name.
How the hell is then the original name was stored in reversed order in arr?
C# code for reversing a string