Hi I am trying to write a method that will reverse a string array onced called. I finished my code , but only get half of the array reversed, leaving the rest unchanged, being stuck on this for hours. so I had to ask on stack as last resort.
int start;
string[] sArray = {
"Reverse", "this", "string", "type", "array"
};
int end = (sArray.Length - 1);
for (start = 0; start < sArray.Length; start++) {
sArray[start] = sArray[end - start];
Console.Write(sArray[start] + ",");
}
// The output supposed to be : array type string this Reverse
// However, I keep getting array type string type array.
// The output supposed to be : array type string this Reverse
// However, I keep getting array type string type array.
Any ideas would be appreciated.