jloga4
6/1/2017 - 7:03 PM

Example that shows how to iterate through an array in reverse order using for loop. From Fundamentals of Computer Programming with C# http:/

Example that shows how to iterate through an array in reverse order using for loop. From Fundamentals of Computer Programming with C# http://www.introprogramming.info/wp-content/uploads/2013/07/Books/CSharpEn/Fundamentals-of-Computer-Programming-with-CSharp-Nakov-eBook-v2013.pdf

int[] array = new int[] { 1, 2, 3, 4, 5 };

Console.Write("Reversed: ");
for (int index = array.Length - 1; index >= 0; index--)
{
  Console.Write(array[index] + " ");
}
// Reversed: 5 4 3 2 1