Hi guys, I’ve been struggling hard trying to solve some of the exercises but this one particularly got my attention.
The exercise is the second one of Array and Lists section.
Looking at the solution I found something interesting I didn’t understand why did Mosh use:
// var array = new char[…]
When he was trying to get a name from the input.
The for loop as well was a bit weird he wanted to have
// name[I -1].
I didn’t understand that.
The exercise is:
2- Write a program and ask the user to enter their name. Use an array to reverse the name and then store the result in a new string. Display the reversed name on the console.
I got the concept but I didn’t quite catch the reason of those things and I didn’t find at his lessons.
I’d appreciate any help!